We are celebrating the 10-year anniversary of the Alteryx Community! Learn more and join in on the fun here.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Multiple IF statements

bakerd90
5 - Atom

Hi

 

I need to create a new column in a worksheet that provides a code based on a set of criteria than be identified from 2 existing columns.

 

My formula so far looks like this

 

if Contains("HT", [Benefit Plan])then "L1"
else if Contains("HTN", [Benefit Plan]) then "L2"
elseif Contains("Prmb", [Benefit Plan]) AND Contains("S & P",[Coverage]) then "L3"

 

etc

 

So in some cases, it only needs to match to 1 column but in others, where there are more specific requirements it will need to match to 2 columns in order to return a result.

 

I had it working when I only needed it to apply logic to 1 column but now i'm applying it to 2 I am getting an error when i try to end the if statement.

 

any help would be greatly appreciated?

2 REPLIES 2
alexnajm
18 - Pollux
18 - Pollux

You need to have a final ELSE condition followed by an ENDIF! Also I think you may have the column and lookup word switched in your contains statements? Typically it would be  Contains([Benefit Plan], "HT")

 

if Contains("HT", [Benefit Plan]) then "L1"
elseif Contains("HTN", [Benefit Plan]) then "L2"
elseif Contains("Prmb", [Benefit Plan]) AND Contains("S & P",[Coverage]) then "L3"

ELSE "Review" ENDIF

bakerd90
5 - Atom

Thanks! I had the end if part already i just hadn't added it to the question.

 

I think the issue was I had my look up words the wrong way round.

 

Thanks for the help!

Labels
Top Solution Authors