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

Alteryx Designer Desktop Discussions

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

Need help to correct the formula

vishwa1979
7 - Meteor

Dear Team,

 

IF and elseif formula not getting.

Getting error.

 

Please help 

3 REPLIES 3
JosephSerpis
17 - Castor
17 - Castor

Hi @vishwa1979 you were missing an else statement in your formula as well as Endif to state the end of the IF. In addtion you set the data type to be numeric I changed the data type to string and it worked. However if you want the result to be numeric then the arguement after the Then will not require to be in quotes e.g. "0.5" would need to be 0.5. String data needs to be quotes numeric data does not to be in quotes.

 

Screenshot 2024-09-30 133118.pngScreenshot 2024-09-30 133350.png

CoG
14 - Magnetar

@JosephSerpis has solved the error in your workflow, but I did want to make a best-practice recommendation, that you consider replacing the large IF statement with a Text Input Tool, then Joining on the two columns used as a conditional check to obtain the corresponding calculation value. (Don't forget to Union to get remaining records). Here is a sample of that with the Text Input Tool preconstructed based on shared data:

Screenshot.png

Screenshot.png

SPetrie
13 - Pulsar

I also agree with reducing the massive if statements. Another alaternative to that is a dynamic replace. You only maintain your list of tests and results and its much easier to add or change conditions when needed.

dynamic1.PNGdynamic2.PNG

Labels
Top Solution Authors