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!

Dev Space

Customize and extend the power of Alteryx with SDKs, APIs, custom tools, and more.

If else error

AS
8 - Asteroid

IF [Account2]= 662321 THEN "S"
ELSEIF [Account2] = 63243 THEN "R"
ELSEIF [Account2] = 612323 THEN "D"
ELSEIF [Account2] = 723234 THEN "O"
ELSEIF [Account2] = 62323 or [Account2]= 614343130 THEN "I"
ELSEIF [Account2]= 503232 or
[Account2]= 50300 or [Account2]= 5024535 or [Account2]= 50436 or [Account2]= 503540 or [Account2]=54565530 or [Account2]=5113500 THEN "C"
ELSEIF [Account2]=6541030 THEN "Fee"
ELSE "None" ENDIF

 

I wrote the correct syntax but still getting error in this if else formula. I checked everything but could not understand why.

Could you please help.

4 REPLIES 4
binuacs
20 - Arcturus

@AS your formula is correct, please check your [Account2] field is numeric data type? if not please use toNumber([Account2]) or change the data type to double

binuacs_0-1647412941743.png

 

AS
8 - Asteroid

Screenshot (5).png

 I'm getting error in the end. Please have a look

binuacs
20 - Arcturus

@AS can you check your Account2 field data type and make sure that it is not string? I also updated your formula instead of multiple OR operator you can use the IN operator

 

IF [Account2]= 662321 THEN "S"
ELSEIF [Account2] = 63243 THEN "R"
ELSEIF [Account2] = 612323 THEN "D"
ELSEIF [Account2] = 723234 THEN "O"
ELSEIF [Account2] IN ( 62323, 614343130) THEN "I"
ELSEIF [Account2] IN( 503232, 50300 ,5024535 ,50436 ,503540 ,54565530 ,5113500) THEN "C"
ELSEIF [Account2]=6541030 THEN "Fee"
ELSE "None" ENDIF
lesliechan
5 - Atom

What is the error message?