Bring your best ideas to the AI Use Case Contest! Enter to win 40 hours of expert engineering support and bring your vision to life using the powerful combination of Alteryx + AI. Learn more now, or go straight to the submission form.
Start Free Trial

General Discussions

Discuss any topics that are not product-specific here.

Formula

Dav
7 - Meteor

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
7 - Meteor

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

Dav
7 - Meteor

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
7 - Meteor

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
7 - Meteor

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