alteryx Community

# Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

## IFERROR formula

8 - Asteroid

Hi how do I convert this Excel formula in Alteryx?  Thank you.

=IFERROR(F3-F5,"-")

9 REPLIES 9
17 - Castor

Hi @BJSOON ,

You can use

if IsNull([F3]-[F5])
then '-'
else [F3]-[F5]
endif

The only problem here is that you will need to leave the data type as string.

Best,

Fernando V.

8 - Asteroid

Thank you!   If I change it from "-" to 0, can I leave the data type as V_WString?

=IFERROR(F3-F5,0)

17 - Castor

If you change the iferror result, you can use as text or numeric.

if IsNull([F3]-[F5])
then 0
else [F3]-[F5]
endif

best,

Fernando V.

8 - Asteroid

Thank you!

8 - Asteroid

Hi Expert, I'm using this formula.. according to your suggestion but this is showing me error

if IsNull([Last order]-[First order])
then "NA"
else [Last order]-[First order]
endif

Error: Formula: Invalid type of subtraction operator

Could you please tell me the mistake I'm doing...

22 - Nova

Hi @AS

In the above scenario "NA" is a string and  [Last order]-[First order] could be number which not same datatype. Both output should be same output.

8 - Asteroid

Both columns are from "Date" datatype and it is only giving error in else part..in above near by "IsNull" this formula is working

22 - Nova

Hi @AS

You need to use DatetimeDiff() for subtracting between dates.

https://help.alteryx.com/20212/designer/datetime-functions

Hope this helps : )

8 - Asteroid

Could not understand.. Have a look on shared image

Labels