Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

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

Mallformed If Statement using a Multi-Row Formula

gregddowns
5 - Atom

I keep getting a Malformed If Statement error for the below function. Any help would be much appreciated. Thank you.

 

IF ISNULL([DEBIT]) THEN IF ISNULL([CREDIT]) THEN "" ELSE

IF CONTAINS([Account],"Total") THEN "" ELSE

IF ISNULL([Row-2:DEBIT]) THEN IF ISNULL([Row-2:Credit]) THEN IF ISNULL([Row-1:Debit]) THEN IF ISNULL([Row-1:Credit]) THEN [Row-2:Account] ELSE

IF ISNULL([Row-1:Debit]) THEN IF ISNULL([Row-1:Credit]) THEN

IF ISNULL([Row-2:Iteration #1]) THEN IF ISNULL([Row-1:Iteration #1]) THEN [Row-3:Iteration #1] ELSE

IF ISNULL([Row-1:Iteration #1]) THEN [Row-1:Account] ELSE

[Row-1:Iteration #1] ENDIF ENDIF ENDIF ELSE ELSE ELSE ELSE ELSE ELSE ELSE ELSE ELSE [Row-1:Iteration #1] ENDIF ENDIF ENDIF ENDIF ENDIF ENDIF ENDIF ENDIF ENDIF

4 REPLIES 4
MarqueeCrew
20 - Arcturus
20 - Arcturus

IF

ISNULL([DEBIT]) AND ISNULL([CREDIT]) THEN "" ELSEIF CONTAINS([Account],"Total") THEN "" ELSEIF 

ISNULL([Row-2:DEBIT]) AND ISNULL([Row-2:Credit]) AND ISNULL([Row-1:Debit]) AND ISNULL([Row-1:Credit]) THEN [Row-2:Account] ELSEIF ISNULL([Row-1:Debit]) AND ISNULL([Row-1:Credit]) AND ISNULL([Row-2:Iteration #1]) AND ISNULL([Row-1:Iteration #1]) THEN [Row-3:Iteration #1]

ELSEIF ISNULL([Row-1:Iteration #1]) THEN [Row-1:Account]

ELSE

[Row-1:Iteration #1]

ENDIF

 

 

Does that work?

 

 Cheers,

 

 mark 

 

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
gregddowns
5 - Atom

Thank you for your response. Your solution is close but not quite there. What I am trying to do it convert the below excel formula into a multi-row formula in alteryx but I am struggling with it. The formula is in cell D8 and the data in column A are "Account", in column B are "Debit", and in column C "Credit", and in column D I am trying to add this formula and name it "Iteration #1". See attached file that I have cleaned. The formula that I am working on is in cell D8 but I will be trying to recreate the formulas in columns D - I to automate this process. Please let me know if there are any questions regarding the file.

 

IF(AND(ISBLANK(B8),ISBLANK(C8)),"",IF(IFERROR(FIND("Total",A8),0)>0,"",IF(AND(ISBLANK(B6),ISBLANK(C6),ISBLANK(B7),ISBLANK(C7)),A6,IF(AND(ISBLANK(B7),ISBLANK(C7)),IF(AND(D6="",D7=""),D5,IF(D7="",A7,D7)),D7))))

ashissanpui
9 - Comet

that error is coming because your ELSE-IF syntax.

 

* ELSEIF is continuation of previous IF statement

* ELSE IF is a start of new IF statement so you need to close this with ENDIF

 

Please try to model your syntax accordingly.

 

Regards,

AShis

RolandSchubert
16 - Nebula
16 - Nebula

Hi @gregddowns ,

 

translated to Alteryx, your Excel formula would be:

 

IF ISEMPTY([Debit]) AND ISEMPTY([Credit]) THEN
''
ELSE
IF CONTAINS([Account],'Total') THEN
''
ELSE
IF ISEMPTY([Row-2:Credit]) AND ISEMPTY([Row-2:Debit]) AND ISEMPTY([Row-1:Debit]) AND ISEMPTY([Row-1:Credit]) THEN
[Row-2:Account]
ELSE
IF ISEMPTY([Row-1:Debit]) AND ISEMPTY([Row-1:Credit]) THEN
IF ISEMPTY([Row-1:Result]) AND ISEMPTY([Row-2:Result]) THEN
[Row-3:Result]
ELSEIF ISEMPTY([Row-1:Result]) THEN
[Row-1:Account]
ELSE
[Row-1:Result]

ENDIF

ELSE
[Row-1:Result]

ENDIF

ENDIF

ENDIF

ENDIF

 

I've attached a sample workflow.

 

Hope this is helpful.

 

Best,

 

Roland

Labels