Hi,
I am trying to create new column based on my below condition. however, this is not working in formula tool. Can someone please help me correcting the IF statement.
IF Contains([Period], "One YearEnded") then "Cumulative" ELSEIF Contains([Period], "_2" and "One YearEnded") then "Annulized"
ELSE "Annulized" ENDIF
(Screenshot attached)
Solved! Go to Solution.
Your screenshot doesn’t end with ENDIF!
But also you need to separate your contains statement - Contains([Period], “_2”) OR Contains([Period], “One YearEnded”)
IF Contains([Period], "One YearEnded") then "Cumulative" ELSEIF Contains([Period], “_2”) OR Contains([Period], “One YearEnded”) then "Annulized"
ELSE "Annulized" ENDIF
been there done that
@alexnajm couldn't the if statement be IF Contains([Period], "One YearEnded") then "Cumulative"
ELSE "Annulized" ENDIF
as at the orginal esle if either way it would be "Annulized" - your way would work, but this would just be a bit more efficent?
Hi Alex --- thanks for this. Now the conditional formula working fine but end result is not as expected. In my column there are values One YearEnded12/31/23 and One YearEnded12/31/23_2. I want to differentiate this as Cumulative and Annualized respectively. However, using your corrected formula I get both as Cumulative. Could you please help further. I even try replacing OR with AND but this doesn't worked.
Thanks for your input but this way also not fulfilling my end goal as explained to Alex in my recent comment.
@aatalai yes I agree that would work and be simpler - I just worked on correcting what was in front of me 😊
@anonymous008_G thats correct - that's because your original IF statement doesn't differentiate between the One YearEnded values. Why can't you just do IF Contains([Period],"_2") THEN "Annualized" ELSE "Cumulative" ENDIF ?
@alexnajm team work makes the dream work
Apologies for providing limited information earlier, but your recent solution also wouldn't work since column contains few other values as well as per below table. My expected output to be all the values which contain "One Year Ended" in period column should be populated as cumulative in the new column and rest other should populate as Annualized including the one "One "YearEndedMM/DD/YY_2".
Period | Return Type |
One YearEnded12/31/23 | Cumulative |
One YearEnded12/31/22 | Cumulative |
One YearEnded12/31/21 | Cumulative |
One YearEnded12/31/20 | Cumulative |
One YearEnded12/31/19 | Cumulative |
One YearEnded12/31/18 | Cumulative |
One YearEnded12/31/17 | Cumulative |
One YearEnded12/31/16 | Cumulative |
One YearEnded12/31/15 | Cumulative |
One YearEnded12/31/14 | Cumulative |
One YearEnded12/31/23_2 | Cumulative |
Two YearsEnded12/31/23 | Annulized |
Three YearsEnded12/31/23 | Annulized |
Four YearsEnded12/31/23 | Annulized |
Five YearsEnded12/31/23 | Annulized |
Ten YearsEnded12/31/23 | Annulized |