Reputation: 69
Below is the if else statement I am using.
IF ([Days]<='0' or [Days]='none') THEN '0'
ELSEIF [Days]>'0' or [Days]<='273.5' THEN '182'
ELSEIF [Days]>'273.5' or [Days]<='548' THEN '365'
ELSEIF [Days]>'548' or [Days]<='913' THEN '730'
ELSEIF [Days]>'913' or [Days]<='1460' THEN '1095'
ELSE '1825'
END
However, I am seeing few rows going off. First column is number of days, second and third columns are same (Calculated field)
Upvotes: 1
Views: 44
Reputation: 11921
You are comparing strings instead of integers. String comparison is based on alphabetical order. That explains why '30' > '273.5'
even though 30 < 273.5
A pair of quotation marks makes a significant difference.
Change the data type for [Days] to a whole number, and then remove the quotes in your calculated field so that you are comparing numbers instead of strings.
Also, you can simplify/clarify your calculation by removing all the tests involving a ">". They are redundant because of the earlier tests - as long as you test in increasing order. Simple is usually better.
Upvotes: 1