Hi
I'm trying to create Nested IF Statement below and keep getting the the following error message "Malformed If Statement"
Can anyone advise what I'm doing wrong
IF [Bought at Band] = 1 THEN [Variance_Band_1_per_each]*[Annualised Eaches Bought]
ELSEIF [Bought at Band] = 2 THEN [Variance_Band_2_per_each]* [Annualised Eaches Bought]
ELSEIF [Bought at Band] = 3 THEN [Variance_Band_3_per_each]* [Annualised Eaches Bought]
ELSEIF [Bought at Band] = 4 THEN [Variance_Band_4_per_each]* [Annualised Eaches Bought]
ELSEIF [Bought at Band] = 5 THEN [Variance_Band_5_per_each]* [Annualised Eaches Bought]
ENDIF
Solved! Go to Solution.
Hi @Pangulia
You need to finish the IF statement with ELSE. If necessary, take a look at the attached workflow.
IF [Bought at Band] = 1 THEN [Variance_Band_1_per_each]*[Annualised Eaches Bought]
ELSEIF [Bought at Band] = 2 THEN [Variance_Band_2_per_each]* [Annualised Eaches Bought]
ELSEIF [Bought at Band] = 3 THEN [Variance_Band_3_per_each]* [Annualised Eaches Bought]
ELSEIF [Bought at Band] = 4 THEN [Variance_Band_4_per_each]* [Annualised Eaches Bought]
ELSEIF [Bought at Band] = 5 THEN [Variance_Band_5_per_each]* [Annualised Eaches Bought]
ELSE 0
ENDIF
If the provided answer helped you to solve the problem/was correct, please accept it as a solution :)
Thanks.
Thanks fore the quick response. I'm Still getting an different error message now. I'm fairly new to Alteryx and can't see what I'm missing
Formula (31) Parse Error at char(411): Formula: tried to apply numeric operator to string value (Expression #1)
I've added the ELSE 0 in below
IF [Bought at Band] = 1 THEN [Variance_Band_1_per_each]*[Annualised Eaches Bought]
ELSEIF [Bought at Band] = 2 THEN [Variance_Band_2_per_each]* [Annualised Eaches Bought]
ELSEIF [Bought at Band] = 3 THEN [Variance_Band_3_per_each]* [Annualised Eaches Bought]
ELSEIF [Bought at Band] = 4 THEN [Variance_Band_4_per_each]* [Annualised Eaches Bought]
ELSEIF [Bought at Band] = 5 THEN [Variance_Band_5_per_each]* [Annualised Eaches Bought]
ELSE 0
ENDIF
Hi @Pangulia
Add a select tool before the formula tool and check the datatype of these columns:
[Bought at Band]
[Annualised Eaches Bought]
[Variance_Band_1_per_each]
[Variance_Band_2_per_each]
[Variance_Band_3_per_each]
[Variance_Band_4_per_each]
[Variance_Band_5_per_each]
The datatype of these columns must be numerical (double,float , fixed decimal or int) for this formula to work.
If the provided answer helped you to solve the problem/was correct, please accept it as a solution :)
Thanks.