Hi There,
good morning,
I am stuck trying to get a Workflow done, this is my issue: in a table I have different customers under [consignee names] but each customer goes to a different terminal (new column that i would like to create with that terminal, so I did a formula using IF for the first customer, but I don't know how to create it for the next customers.
Ex (everything ok through here).
IF [Consignee Name]="Customer1" THEN "Column AA" ELSE "" ENDIF
So I need to continue the formula adding
Customer 2 to Column AB
Customer 3 to Column CD
etc etc.
Any help I will appreciate it.
Thanks in advance,
Solved! Go to Solution.
Hello @PedroPerdomo,
You can do this using the ELSEIF functionality in the Formula tool:
IF [Consignee Name] = "Customer1" THEN "Column AA" ELSEIF [Consignee Name] = "Customer2" THEN "Column AB" ELSEIF [Consignee Name] = "Customer3" THEN "Column CD" ENDIF
Hope that helps!
Sam :)
Hi Sam,
thank you,
but i am still getting Malformed if Statement and ENDIF (shows with a red underline).
you know why?
Hello @PedroPerdomo
Apologies I forgot to add in the final ELSE statement into the IF statement. It always requires an ELSE statement for any other values that are passed through the formula and if they're not important then I would usually just set them to NULL.
Amended Formula:
IF [Consignee Name] = "Customer1" THEN "Column AA" ELSEIF [Consignee Name] = "Customer2" THEN "Column AB" ELSEIF [Consignee Name] = "Customer3" THEN "Column CD" ELSE Null() ENDIF
Sam :)
THANK YOU SO MUCH SIR
its work
Adding onto this thread instead of starting a new one.
I'm getting the same error message. I've tried ELSE null (), I've tried caps, lowercase, splitting END and IF into two, adding another ELSE IF, and so on. I can't figure out why Alteryx won't accept the formula despite indicating that the formula is good since all the text is color coded!
These If/then formulas are enormously frustrating, each and every time I try to write one, for this same reason. That speaks to user error but I have no idea what I am doing wrong or why, since I'm following accepted practices. Rant over, sorry.
Formula and image below.
Thanks
IF [EVENT_NAME] = "Add" THEN "Data Added" Else IF [EVENT_NAME] ="Foldering" Then "Data Foldered" Else IF [EVENT_NAME] = "Display" Then "Data Opened" Else IF [EVENT_NAME] =
"Download" Then "Data Downloaded" Else IF
[DELIVERY_DESTINATION] = "attached_printer" And [EVENT_TYPE] = "page" Then "Page Printed" Else IF [DELIVERY_DESTINATION]="Download" And [EVENT_TYPE] = "page" Then "Page Download" Else IF [DELIVERY_DESTINATION]="Email" And [EVENT_TYPE] = "page" Then " Page Emailed" Else IF [EVENT_NAME]="Blocking" Then "Data Blocked"
Else "" ENDIF
Remove the space between Else and If
Use ElseIf
To see the correct format for all functions: on the Functions page, click the third icon for Expand All
https://help.alteryx.com/current/Reference/Functions.htm
Then search for "IF"
I'll be darned. Thanks, Chris.
I wonder why Alteryx doesn't give me an error after that first incorrect space instead of saying that the error is at the very end. That would have saved me quite a bit of frustration.