Dears,
I'm currently trying to create a formula in the Designer where IF and AND are used multiple times.
I tried different combination but the result is always a parse error, I hope maybe somebody is able to help me out.
Basically the idea is the following - create a new column where:
First IF: Busn_Area is 4690 and MUV is YES and Tm1 reporting is other -> THEN: "OTHER Products Base"
Second IF: Busn_Area is 1860 and MUV is YES and Tm1 reporting is other -> THEN: "OTHER Products Bio"
Third IF: Busn_Area is 4690 and MUV is NO -> "THEN: OTHER Accounts Base"
Fourth IF: Busn_Area is 1860 and MUV is NO -> "THEN: OTHER Accounts Bio"
For all the other lines, give me the result in TM1 reporting
Here below the latest formula I created:
IF ([Busn_Area]="4690" && [MUV]="YES" && [TM1 reporting]="OTHER") THEN "OTHER Products Base"
ELSE IF ([Busn_Area]="1860" && [MUV]="YES" && [TM1 reporting]="OTHER") THEN "OTHER Products Bio"
ELSE IF ([Busn_Area]="4690" && [MUV]="NO") THEN "OTHER Accounts Base"
ELSE IF ([Busn_Area]="1860" && [MUV]="NO")THEN "OTHER Accounts Bio"
ELSE [TM1 reporting] ENDIF
Can anyone of you help me with the formula creation?
Thanks a lot in advance!!
Kind regards
Francesco
Solved! Go to Solution.
Hi @Francesco07 ,
You almost got it right. The problem are the spaces between the ELSE IF.
IF ([Busn_Area]="4690" && [MUV]="YES" && [TM1 reporting]="OTHER") THEN "OTHER Products Base"
ELSEIF ([Busn_Area]="1860" && [MUV]="YES" && [TM1 reporting]="OTHER") THEN "OTHER Products Bio"
ELSEIF ([Busn_Area]="4690" && [MUV]="NO") THEN "OTHER Accounts Base"
ELSEIF ([Busn_Area]="1860" && [MUV]="NO")THEN "OTHER Accounts Bio"
ELSE [TM1 reporting] ENDIF
Best,
Fernando Vizcaino
Hi Fernando,
thanks for the feedback.
However it is still not working, I still getting error message 351 - malformed If statement.
Is there maybe an issue with the last ELSE / ENDIF?
Thanks a lot.
Francesco
Hi @Francesco07 ,
There is nothing wrong with the way you have built your conditional.
One small detail about the Busn_Area, since you are using Busn_Area="4690", it means that your column is in string format.
I'm attaching my workflow for you to check it. If this doesn't help you, please share a screenshot of your formula tool and function + a screenshot of a dataset sample please.
Best,
Fernando Vizcaino
Hi Fernando,
Thanks a lot, I really appreciated the support.
It was not working because I had to change the data type to string as you suggested.
I wish you a nice day!
Francesco