Get Inspire insights from former attendees in our AMA discussion thread on Inspire Buzz. ACEs and other community members are on call all week to answer!

Alteryx Designer Desktop Discussions

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

Malformed IF Statement

ebowlan
6 - Meteoroid

I am trying to write a formula using the formula tool that has several IF statements involved.  After setting the conditional statement up as in the graphic, i have received the following error:

 

"Parse Error at char(1184): Malformed If Statement (Expression #1) Parse Error at char(13): Malformed If Statement (Expression #2) Parse Error at Char(0): Empty expression (Expression #3) Parse Error at char(0): Empty expression (Expression #4) Parse Error at char(0): Empty expression (Expression #5) Parse Error at char(0): Empty expression (Expression #6) Parse Error at char(0): Empty expression (Expression #7)

 

Can someone help me figure out how to correct this?  

 

ebowlan_0-1599717341833.png

 

5 REPLIES 5
cgoodman3
14 - Magnetar
14 - Magnetar

IF statements and Nested IFs (using ElseIF) need an Else statement before the final EndIF.

 

Therefore add something like

ELSE “Error” 
ENDIF

 

and it should work.

 

as a tip, when there is an error in the statement the text turns to black to show you were the error is.

Chris
Check out my collaboration with fellow ACE Joshua Burkhow at AlterTricks.com
RolandSchubert
16 - Nebula
16 - Nebula

Hi @ebowlan ,

 

add an "ELSE" statement between the last "ELSEIF" and "ENDIF". The structure always has to be:

 

IF

 

ELSEIF

 

ELSE

 

ENDIF

 

Best,

 

Roland

vizAlter
12 - Quasar

Hi @ebowlan — You need to correct the last line

 

vizAlter_0-1599718378680.png

 

santiagoch1994
5 - Atom

Solving with 2 formula tools and 1 summarize

apurvar
5 - Atom

if [Voucher_Date]>= 2021-04-01 AND [Voucher_Date]<=2022-03-31 then '2021-2022'
elseif [Voucher_Date] >= 2022-04-01 AND [Voucher_Date]<= 2023-03-31 then '2022-2023'
else '2023-2024 '
Endif

 

still showing here... malformed if statement 

Labels