Hi
Im trying to write the following into the formula tool - if [bmi] > 24.9 THEN "1" elseif [bmi] < 18.5 THEN "2" else "3" endif
it keeps coming up with the following error - Error: Formula (5): The formula "bmi" resulted in a string but the field is numeric. Use ToNumber(...) if this is correct. (Expression #4)
anyone able to help me?
Solved! Go to Solution.
try this, removing the double-quotes.
if [bmi] > 24.9 THEN 1 elseif [bmi] < 18.5 THEN 2 else 3 endif
i removed the quotation marks and it worked but only showing 1 and 3 on data not recognize 2
As your error message is saying [bmi] is a string datatype but you need to numeric to do numeric compare.
As the error message suggests you need to use ToNumeric() function.
Formula
if ToNumber([bmi]) > 24.9 THEN "1"
elseif ToNumber([bmi]) < 18.5 THEN "2"
else "3" endif
Workflow:
If you are facing please reply on the same post i will help you out.
Hope this helps 🙂
If this post helps you please mark it as solution. And give a like if you dont mind 😀👍
when i put that in it comes up error, when i use this --- if [bmi] > 24.9 THEN 1 elseif [bmi] < 18.5 THEN 2 else 3 endif
there is no error it just will not recognize 2 , so all my data is either 1 or 3
Hmm thats great
Can you check you data to see if there is any value below 18.5 so that it will be tagged as 2
You can use a filter tool for this.
If you are still facing the issue. You can try this once
if ToNumber([bmi]) > 24.9 THEN 1
elseif ToNumber([bmi]) >= 18.5 THEN 3
else 2 endif
If you are still facing issue share me a snapshot where you think value should have been 2.
Will be happy to help 🙂
thank you for your help 🙂