Free Trial

General Discussions

Discuss any topics that are not product-specific here.

Formula

Dav
6 - Meteoroid

Hi All

 

I'm new to my Alteryx journey. I'm trying to automate a process and have this formula written but I keep getting an error on the endif.

 

Can someone tell me where I am going wrong

 

if (IsNull([GTH Charge rate]) or IsNull([A])) then "Missing data" else if [GTH Charge rate] = [B] then "Correct" else "Validate" endif

7 REPLIES 7
Luke_C
17 - Castor
17 - Castor

Hi @Dav 

 

Either add a second 'endif' at the end, or change 'else if' to 'elseif'.

 

Right now the second if is being treated as a new formula, so you have two if statements that need two endif's. 

binuacs
21 - Polaris

@Dav 

If IsNull([GTH Charge rate]) or IsNull([A]) Then
    "Missing data"
ElseIf [GTH Charge rate] = [B] Then
    "Correct"
Else
    "Validate"
EndIf
Dav
6 - Meteoroid

Thanks for providing help, I tried both, adding a second ENDIF and changing the 'else if' to 'elseif' still didn't work

Dav
6 - Meteoroid

Thankyou for your help, I tried your formula and it did not work. At the '=' part it comes up with an "Invalid type in operator ==.)

binuacs
21 - Polaris

Can you check your data type of the fields and make sure the fields GTH Charge Rate, A and B are same data type, also can you screen shot your formula tool error 

Dav
6 - Meteoroid

Screenshot 2024-12-12 101831.png

 

Replace the A and B with the actual data names. I also changed the last else to an Else if and and elseif but still wouldn't work

Dav
6 - Meteoroid

All fixed now, sorry rookie mistake. One of my data set number wasnt actual a number but was in text format in excel. Just changed it to number and it works

Labels
Top Solution Authors