Patrick
Patrick

Reputation: 232

If Last 2 Digits Of Cell Value Are Greater Than And Less Than

I'm trying to figure out the correct syntax for the following formula.

I have a Named Range "Width" which is always a 3 digit value eg.126,298,300,495 etc.

If the last 2 digits of the value from Named Range "Width" is greater than or equal to 00 and less than or equal to 49 then return "True" else "False"

=IF(AND(RIGHT(Width,2)>=00,(RIGHT(Width,2)<=49)),"True","False")

Hope someone can help me out with this.

Thanks in advance.

Upvotes: 0

Views: 1093

Answers (1)

Jos Woolley
Jos Woolley

Reputation: 9062

The issue you have is that RIGHT returns a string, which you are then comparing to a numeric. Also, it's generally preferable to return Boolean TRUE/FALSE results, rather than text entries like "True" and "False". So:

=AND(0+RIGHT(Width,2)>=0,0+RIGHT(Width,2)<=49)

FYI you could also consider the simpler:

=ISEVEN(QUOTIENT(Width,50))

Upvotes: 2

Related Questions