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

3 condition if statement

henrygeorge
8 - Asteroid

How do I frame an if statement with 3 conditions in such a way that -

If (coulumnid) =(count) then its changes its name to "Target column" and if (ColumnId) = (Count)-1 then it changes to "TargetName1" and if  (ColumnId) = (Count)-2 then it changes to "TargetName2" if none of these factors match it will be (Name)

 

This is what I wrote down using formula tool -

if [ColumnID] = [Count] then
 "TargetColumn"
elseif [ColumnID] = [Count]-1 then
"TargetColumn1"
Elseif [ColumnID] = [Count]-2 then
"TargetColumn2"

Else [Name]
Endif

 

I get an error. Please help

2 REPLIES 2
OllieClarke
15 - Aurora
15 - Aurora

Hi @henrygeorge Your calc looks right to me, assuming [columnID] and [Count] are both numeric fields, and you're creating a new, named, string column. What error message are you getting?

 

Ollie

Jonathan-Sherman
15 - Aurora
15 - Aurora

I agree with @OllieClarke the calc looks fine, are your columns strings or numeric? Try changing your calculation to:

 

if ToNumber([ColumnID]) = ToNumber([Count]) then
 "TargetColumn"
elseif ToNumber([ColumnID]) = (ToNumber([Count])-1) then
"TargetColumn1"
Elseif ToNumber([ColumnID]) = (ToNumber([Count])-2) then
"TargetColumn2"

Else [Name]
Endif

 

If this solves your issue please mark the answer as correct, if not let me know!

 

Regards,

Jonathan

Labels
Top Solution Authors