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
Solved! Go to Solution.
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
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