Alteryx Designer Desktop Discussions

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

Writing an If statement identifying multiple values

Adam_B
8 - Asteroid

Hello, 

 

I have an IF statement that I need to identify multiple values in one field and change those Contract types to a different name.  Here is what I have as the formula:

If [Contract Id] = "CW2293919","CW2290258","CW2290427",“CW2291285”,“CW2290240”,“CW2290769”,"CW2291040",“CW2291294”,“CW2291326”,“CW2291328”,“CW2291331”,“CW2291425”,“CW2291954”,“CW2291956”,“CW2292754”,“CW2293279”,“CW2293387”,“CW2293399”,“CW2293404”,“CW2293412”,“CW2293433”,“CW2293741”,“CW2294151”,“CW2294311”,
“CW2297164”
Then [Contract Type] "Supplier Code of Conduct Agreement" ELSE [Contract Type] ENDIF

 

However, there is something wrong and I can't figure out why. 

Adam_B_0-1680191364108.png

 

Please help

 

Thanks

Adam 

6 REPLIES 6
binuacs
20 - Arcturus

@Adam_B use IN () instead of = in the if statement

StellaBon
11 - Bolide

Instead of using commas, you would need then after each instance followed by ELSEIF Then for each new instance. But I would suggest learning the SWITCH() formula which would work perfectly with your current format of comma delimited string values. Good Luck!

 

StellaBon

Adam_B
8 - Asteroid

@StellaBon @binuacs That didn't seem to work, this is the output:

Adam_B_0-1680192140592.png

 

DataNath
17 - Castor

Hey @Adam_B, looks like you also have [Contract Type] left in before your THEN. Try this:

 

If [Contract Id] IN ("CW2293919","CW2290258","CW2290427",“CW2291285”,“CW2290240”,“CW2290769”,"CW2291040",“CW2291294”,“CW2291326”,“CW2291328”,“CW2291331”,“CW2291425”,“CW2291954”,“CW2291956”,“CW2292754”,“CW2293279”,“CW2293387”,“CW2293399”,“CW2293404”,“CW2293412”,“CW2293433”,“CW2293741”,“CW2294151”,“CW2294311”,
“CW2297164”)
THEN "Supplier Code of Conduct Agreement"
ELSE [Contract Type] ENDIF
Adam_B
8 - Asteroid

@DataNath That worked, thank you!

StellaBon
11 - Bolide

I forgot Alteryx could use IN-- In wins! 

Labels