简体   繁体   中英

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.

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))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM