Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

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

IFERROR formula

BJSOON
8 - Asteroid

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

 

=IFERROR(F3-F5,"-")

9 REPLIES 9
fmvizcaino
17 - Castor
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.

fmvizcaino_0-1582884180774.png

 

Best,

Fernando V.

 

BJSOON
8 - Asteroid

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

 

 

=IFERROR(F3-F5,0)

 

fmvizcaino
17 - Castor
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.

BJSOON
8 - Asteroid

Thank you!

AS
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...

atcodedog05
22 - Nova
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.

AS
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

atcodedog05
22 - Nova
22 - Nova

Hi @AS 

 

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

 

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

 

Hope this helps : )

AS
8 - Asteroid

Could not understand.. Have a look on shared image

Labels