I am trying to create a score 1-8 for my data using a Formula tool with an IF statement. It makes sense to me and I feel like it should work but once I add the ENDIF at the end of the statement it invalidates the last line of code. If somebody knows how to fix this code or has a better way to do this I'm all ears.
Solved! Go to Solution.
Hey @nicktekippe, within the expression you're trying to apply numerical functions (like >=, = etc) to strings as you're wrapping the numbers in quotes. If you make sure that R12 IP is a numeric data type and then remove all of the quotes around the values you're checking like '0', '1', '60' then that should help.
Let's keep it simple....
IF
[R12 IP] = 0 THEN '0' ELSEIF
[R12 IP] < 60 THEN '1' ELSEIF
[R12 IP] <120 THEN '2' ELSEIF
[R12 IP] <180 THEN '3' ELSEIF
[R12 IP] <240 THEN '4' ELSEIF
[R12 IP] <300 THEN '5' ELSEIF
[R12 IP] <360 THEN '6' ELSEIF
[R12 IP] <420 THEN '7' ELSEIF
ELSE
'8'
ENDIF
Note: This assumes that you've turned incoming data into NUMBER types.
Cheers,
Mark