IF Statement Logical Test

Bob_W

New Member
Joined
Jun 15, 2017
Messages
9
Apologies if this is a ridiculous question but please bear with me.

I recently inherited a workbook which was designed and built by a former colleague. Whilst working through the logic to ensure I understood what is happening in the various formulae and lookups, I've noticed a simple IF statement that I'm surprised works. It is:

=IF(A2>0,A2,"No")

Column A contains either:
- a 2-digit code formatted as Text and these codes are a combination of alpha & numeric characters, such as 1L, 2L, EF, IE, 5D, etc
- a 0 (zero)
- or the cell is [blank]

So my question is, why does the formula give True when the cell value is anything other than 0 or [blank]. Sure the logic test is numerical and therefore would only give true for a number value greater than 0. I would expect any kind of text string to give false. Or is there something obvious I am missing??

Thanks in advance.
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
In Excel a string is considered to be larger than any number.
 
Upvote 0
Solution
In Excel a string is considered to be larger than any number.
Thanks, so it really is that simple! All these years I've been doing much more complicated formulae to achieve the same outcome! Every day's a school day as they say! :oops:
 
Upvote 0
Yup, it really is that simple. :)
Glad to help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,223,231
Messages
6,170,884
Members
452,364
Latest member
springate

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top