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

What is wrong with - "IF c THEN t ELSEIF c2 THEN t2 ELSE f ENDIF" - formula ??

Theshantanu
5 - Atom

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

3 REPLIES 3
FrederikE
13 - Pulsar

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.

binuacs
21 - Polaris

@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"

 

 

Theshantanu
5 - Atom

Thanks for quick reply .. now it's working fine.

 

Theshantanu_0-1685097869809.png

 

Labels
Top Solution Authors