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

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
62,638
Office Version
  1. 365
Platform
  1. Windows
In Excel a string is considered to be larger than any number.
 
Solution

Bob_W

New Member
Joined
Jun 15, 2017
Messages
9
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:
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
62,638
Office Version
  1. 365
Platform
  1. Windows
Yup, it really is that simple. :)
Glad to help & thanks for the feedback.
 

Forum statistics

Threads
1,141,818
Messages
5,708,769
Members
421,589
Latest member
b_gernert

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
Top