Why do I always get error with multiple "IF THEN ELSE" formula in Alteryx.?
IF [Count_of_Enrolled_Patients] = "0"
THEN "HCPs with 0 Pts"
ELSEIF [Count_of_Enrolled_Patients] = "1"
THEN "HCPs with 1 Pts"
ELSEif [Count_of_Enrolled_Patients] > 1 AND [Count_of_Enrolled_Patients] < 6
Then "HCPs with 2-5 Pts"
Elseif [Count_of_Enrolled_Patients] >5 AND [Count_of_Enrolled_Patients] <11
Then "HCPs with 6-10 Pts"
Elseif [Count_of_Enrolled_Patients] > 10 AND [Count_of_Enrolled_Patients] < 16
Then "HCPs with 11-15 Pts"
Elseif [Count_of_Enrolled_Patients] > 15
Then "HCPs with >= 16 Pts."
Else "-"
ENDIF
This is not working. Why am I not able to close the formula with "ENDIF" ..??y
I do not understand at the last "ENDIF" is not working: please see screeshots
Solved! Go to Solution.
Hey @Theshantanu,
The Datatype of your Count... field is the problem.
The notation with quotes in the IF-Statement is only used when it's a string field. If it is a number field you have to remove the quotation marks.
@Theshantanu If the data type of the field [Count_of_Enrolled_Patients] is string type
then put in quotes, seems to be only for the first and 3rd line you have the quotes for the values
IF [Count_of_Enrolled_Patients] = "0"
THEN "HCPs with 0 Pts"
ELSEIF [Count_of_Enrolled_Patients] = "1"
Thanks for quick reply .. now it's working fine.
User | Count |
---|---|
17 | |
15 | |
15 | |
8 | |
6 |