Alteryx Designer Desktop Discussions

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

Excel nested if statement in Alteryx

Data_Alter
8 - Asteroid

I have this if statement in excel sheet which I need to replicate in Alteryx

 

=((IF((C13>0),(IF((H13<=C13),(IF(C13=M13,0,H13)),C13)),0)))

 

Am I right that this in Alteryx translates to

 

If

C13= M13 then 0

elseif C13.> 0 and H13 <=C13

then 

H13

else

C13

endif

 

if yes then where does last 0 goes.

9 REPLIES 9
Luke_C
17 - Castor

Hi @Data_Alter 

 

It would be helpful if you could share some data, but I think this would work. You will need to swap in the column names instead of cells:

 

If

C13= M13 then 0

elseif C13.> 0 and H13 <=C13

then 

H13

elseif C13.> 0 and H13 > C13

then

C13

else 

0

endif

 

IraWatt
17 - Castor
17 - Castor

I would say that translates to:

IF [C13]>0 THEN
IF [H13]<=[C13] THEN
IF [C13]=[M13] THEN 0 
ELSE [H13]
ENDIF
ELSE [C13]
ENDIF
ELSE 0
ENDIF

 

IraWatt_0-1654621408400.png

Definitely double check the output is the same 😄

Any questions or issues please ask :)
HTH!
Ira

Data_Alter
8 - Asteroid

Thanks the data is here and I need to replicate formula in column I.

 

 

 

 

 

IraWatt
17 - Castor
17 - Castor

I added the formula you initially asked for:

IraWatt_0-1654678059967.png

 

Data_Alter
8 - Asteroid

@IraWatt  Thank you so much.

 

I thought using the first part , I will be replicate the whole formula but I am getting stuck. Is it possible to replicate the whole thing in cell I3

IraWatt
17 - Castor
17 - Castor

@Data_Alter Column I's formula is completely different from the one you initially gave:

IF((

IF((C3>0),(

IF((H3<=C3),(

IF(C3=M3,0,H3)),C3)),0)-

IF(F3<=C3, F3, 0)+

IF(C3<0, C3, 0))<=0, 0, (

IF((C3>0),(

IF((H3<=C3),(

IF(C3=M3,0,H3)),C3)),0)-

IF(F3<=C3, F3, 0)+

IF(C3<0, C3, 0)))

 

Alteryx's IIF are the same as Excel If's so I just converted it that way

 

IIF((

IIF([LEDGER OPEN BALANCE]>0,(

IIF([DEBT 300 + DAYS]<=[LEDGER OPEN BALANCE],(

IIF([LEDGER OPEN BALANCE]=[ADJUSTMENT],0,[DEBT 300 + DAYS])),[LEDGER OPEN BALANCE])),0)-

IIF([DEBITS 300 + DAYS JOURNAL INC VAT]<=[LEDGER OPEN BALANCE], [DEBITS 300 + DAYS JOURNAL INC VAT], 0)+

IIF([LEDGER OPEN BALANCE]<0, [LEDGER OPEN BALANCE], 0))<=0, 0, (

IIF(([LEDGER OPEN BALANCE]>0),(

IIF(([DEBT 300 + DAYS]<=[LEDGER OPEN BALANCE]),(

IIF([LEDGER OPEN BALANCE]=[ADJUSTMENT],0,[DEBT 300 + DAYS])),[LEDGER OPEN BALANCE])),0)-

IIF([DEBITS 300 + DAYS JOURNAL INC VAT]<=[LEDGER OPEN BALANCE], [DEBITS 300 + DAYS JOURNAL INC VAT], 0)+

IIF([LEDGER OPEN BALANCE]<0, [LEDGER OPEN BALANCE], 0)))

 

IraWatt_1-1654678851056.png

 

 

 

IraWatt
17 - Castor
17 - Castor

Just noticed I've updated my Answer @Data_Alter, that is a scary amount of IF statements 😅

Data_Alter
8 - Asteroid

Thanks @Ira , you are a star. I didn't know IIF statement is same as excel. 

IraWatt
17 - Castor
17 - Castor

No worries @Data_Alter ! 😄

Labels