Join the Inspire AMA with Joshua Burkhow, March 31-April 4. Ask, share, and connect with the Alteryx community!

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

IF Statement Error

sureslala
8 - Asteroid

Hello

I need help with a multiply nested 'IF' statement pls. Thinking it should be straight forward as I've done a few of these before however I can't resolve this one.

 

In excel, the formula is  =IF(OR(B2="",B2=0,C2="CLN"),A2,B2)

 

sureslala_2-1647018440747.png

 

Where in my attachments

A = F_Amount

B = F_NNDXFLW

C = Strategy Type

 

My formula is 

IF [F_NNDXFLW] = "" THEN [F_AMOUNT]
ELSEIF [F_NNDXFLW] = "0" THEN [F_AMOUNT]
ELSEIF [Strategy Type] = "CLN" THEN [F_AMOUNT]
ELSE [F_NNDXFLW]

 

Before I type in 'ENDIF' there doesn't appear to be any errors in my formula but when I add 'ENDIF' I get a parse error.

 

Any assistance would be much appreciated.

 

Thanks

Sures

 

3 REPLIES 3
Luke_C
17 - Castor
17 - Castor

Hi @sureslala 

 

What's the data type of F_NNDXFLW? I suspect it's numeric and you're trying to treat it as a string. If it's numeric, change it to: 

 

IF isempty([F_NNDXFLW]) THEN [F_AMOUNT]
ELSEIF [F_NNDXFLW] = 0 THEN [F_AMOUNT]
ELSEIF [Strategy Type] = "CLN" THEN [F_AMOUNT]
ELSE [F_NNDXFLW]

ENDIF

 

JosephSerpis
17 - Castor
17 - Castor

Hi @sureslala if you update the syntax to this because you don't use commas for numeric arugments and ISEMPTY or ISNULL is a better function to test if a field is empty/null it should work without error.

 

 

IF Isempty([F_NNDXFLW]) THEN [F_AMOUNT]
ELSEIF [F_NNDXFLW] = 0 THEN [F_AMOUNT]
ELSEIF [Strategy Type] = "CLN" THEN [F_AMOUNT]
ELSE [F_NNDXFLW]
ENDIF

 

 Flow_11032022.JPG

atcodedog05
22 - Nova
22 - Nova

Hi @sureslala 

 

Change the formula to below. [F_NNDXFLW]  is numeric so the previous logic is for string and wont work.

 

atcodedog05_0-1647019275872.png

 

Hope this helps : )

 

Labels
Top Solution Authors