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

My formula won't work and I don't know why

kpoghon
5 - Atom

I've the below conditional formula using other variables and its been fine. The only thing I've changed are the conditions. Can anyone help me find what's wrong. The error coming up is 'ENDIF' causes the formula to be a malformed IF statement

 

IF [TAT from confirmed quote to notification of payment/policy collection]<=3 AND [TAT from confirmed quote to notification of payment/policy collection]>=1 THEN "1-3 days" ELSEIF [TAT from confirmed quote to notification of payment/policy collection]<=7 AND [TAT from confirmed quote to notification of payment/policy collection]>=4 THEN "4-7 days" ENDIF

7 REPLIES 7
ShankerV
17 - Castor

Hi @kpoghon 

 

As per the syntax of NESTED IF, 

 

ELSE is missing.

 

IF condition

ELSEIF condition

ELSE

ENDIF

 

Many thanks

Shanker V

ShankerV
17 - Castor

Hi @kpoghon 

 

You can try the below.

 

IF [TAT from confirmed quote to notification of payment/policy collection]<=3 AND [TAT from confirmed quote to notification of payment/policy collection]>=1

THEN "1-3 days"

ELSEIF [TAT from confirmed quote to notification of payment/policy collection]<=7 AND [TAT from confirmed quote to notification of payment/policy collection]>=4

THEN "4-7 days"

ELSE null()

ENDIF

 

or 

 

IF [TAT from confirmed quote to notification of payment/policy collection]<=3 AND [TAT from confirmed quote to notification of payment/policy collection]>=1

THEN "1-3 days"

ELSEIF [TAT from confirmed quote to notification of payment/policy collection]<=7 AND [TAT from confirmed quote to notification of payment/policy collection]>=4

THEN "4-7 days"

ELSE ""

ENDIF

 

Many thanks

Shanker V

nagakavyasri
12 - Quasar

Add ELSE condition before ENDIF

kpoghon
5 - Atom

Hi both,

 

Thanks for the help. I did what you said but  the formula still isn't working. Everything after ELSE turns black. An error comes up for invalid operator but no other errors appear.

 

Screenshot 2023-06-22 101559.jpg

 

FinnCharlton
13 - Pulsar

Hi @kpoghon , an 'Invalid Operator' error happens due to an incorrect data type. Because you are using a '<=' operator, Alteryx is expecting your field to be a number, and when it isn't it causes an error. 

 

To fix this, put a select tool before your formula and change the data type of your [TAT from confirmed quote...] field to a Double. 

Hope this helps!

FinnCharlton
13 - Pulsar

@kpoghon This also might happen if you're trying to update your [TAT...] field with the formula tool. Instead of updating the current field, try making a new field instead.

FinnCharlton_0-1687511090550.png

 

kpoghon
5 - Atom

Thank you so much! This solved it!

Labels
Top Solution Authors