Hi,
Would like to know what is wrong with the formula below. I got the error "Error: Formula (51): Parse Error at char(81): Invalid type in operator <. (Expression #1)"
IIF([Hours Closed]<24, "<24", IIF([Hours Closed]<48, "24-48", IIF([Hours Closed]<72,"49-72",">72")))
Thanks in advance.
Try this:
IIF(ToNumber([Hours Closed]) < 24, "<24", IIF(ToNumber([Hours Closed]) < 48, "24-48", IIF(ToNumber([Hours Closed]) < 72,"49-72",">72")))
From pure "Excel" syntax, your formula is fine (but the logic is not).
The error message "Error: Formula (51): Parse Error at char(81): Invalid type in operator <. (Expression #1)" indicates that this is a type error.
Alteryx is a type-strong language, so you need to make sure that the data type is appropriate. In this case, it looks like the field "Hours Closed" is not numeric. Please check what type you have assigned it - or, alternatively you can insert a Select tool, to change the field "Hours Closed" to one of the acceptable numeric types (anything between Byte and Double if you click on the drop down will work).
Syntax aside, please also have a 2nd look at the logic. With the current formula, if Hours Closed = 48, then the output will give "49-72". is this your intended outcome?
Cheers,
Dawn.
@JingYih_Herbalife you can try this too
If Tonumber([hours closed]) < 24 then "<24"
elseif Tonumber([hours closed]) >=24 and Tonumber([hours closed]) <= 48 then "24-48"
elseif Tonumber([hours closed]) >=49 and Tonumber([hours closed]) <= 72 then "49-72"
else ">72" endif