Hi All,
I was wondering if anyone knows of a way to do a multi-condition 'IF THEN ELSE' statement in the formula tool,
I want to replace the contents of a string but only if two conditions are met, so for example:
Output Field
[FIELD 1]
IF [FIELD 2] = "X" and [FIELD 3] = "Y" THEN "Replacement Text" ELSE [FIELD 1] ENDIF
Alternitivly is there a better way to acheive this?
Thanks in advance...
Solved! Go to Solution.
Hi guys, I'm trying to create an If statement with 3 conditions.
But cant get it to work, basically I'm wanting a new column with a Y/N depending on the three previous column rules ("Y", "N", "N" = "Y")
i.e. IF [x]="Y" THEN "Y" ELSEIF [x2]="N" THEN "Y" ELSEIF [x3]="N" THEN "Y" ELSE "N" ENDIF
Any ideas where I am going wrong?
Hi Ben,
The error reads: "Parse Error at char(0)L Invalid type in operator ==.(Expression #1)
This is the written formula: IF [2 Case EOQ?]="Y" THEN "Y" ELSEIF [Days Cover Filter]="N" THEN "Y" ELSEIF [Case More Than £50?]="N" THEN "Y" ELSE "N" ENDIF
Okay, so this is because your fields are not strings; could you check the datatype of the fields prior to your formula tool? Perhaps they are set to bool? In which case your statement needs to look something like...
IF [2 Case EOQ?] THEN "Y" ELSEIF ![Days Cover Filter] THEN "Y" ELSEIF ![Case More Than £50?] THEN "Y" ELSE "N" ENDIF
With bool fields Alteryx will automatically check for a positive class hence [2 Case EOQ?] alone. If I want to check the negative class then I can add an exclamation mark in front.
Ben
Hi Ben,
Thanks for the help, that has worked!!
User | Count |
---|---|
19 | |
15 | |
15 | |
9 | |
8 |