Compare a character and a number in Microsoft Excel

Viewed 107

I am accidental to make a comparison of "#" and the value 50,000; my formula is: "#">50000 => result is TRUE.

Example

I wonder how it can be TRUE?

  • Which number is "#" equal to?

  • And the reflect number for the special characters and normal characters in Microsoft Excel.

Thank you very much.

1 Answers

You will be surprised to know that even if you test Excel specification's BigNum i.e. 9.99E+307 with above condition then also it returns TRUE.

This is happening because you are essentially comparing two dissimilar data-types (# is being treated as string while 50000 is number) with each other and Excel is internally converting them to some common format before producing the results.

If you compare the results for any number against string data then your result is going to be the same i.e. a test like ="a">50000" is also going to produce the same result as well as ="1">50000.

Note: I am unsure about the common format that Excel is converting inputs internally to.

Related