why excel shows result "YES" when =if(B2>1,"YES","NO") and B2 cell is "word"
I expected the result to be error because Cell B2 was not a number, thx
why excel shows result "YES" when =if(B2>1,"YES","NO") and B2 cell is "word"
I expected the result to be error because Cell B2 was not a number, thx
Text values are considered to be "larger" than numeric values. This is because text comparisons are carried out by comparing the ASCII code of the characters ("A" has a code of 65, "B" is 66, and so on - lower case letters have codes which are 32 higher). The digits 0,1,2, etc. have codes which start at 48.
Hope this helps.
Pete
All text is treated as being greater than any number, hence you get "YES"
Try:
=IF(ISTEXT(B2),"NO",IF(B2>1,"YES","NO"))
Ali
Enthusiastic self-taught user of MS Excel who's always learning!
Don't forget to say "thank you" in your thread to anyone who has offered you help.
You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.
Forum Rules (updated August 2023): please read them here.
You could use:
=if(N(B2)>1,"YES","NO")
since N will return 0 for text.
Rory
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks