Determine if first character in string is greater than zero

BillTony

Board Regular
Joined
May 3, 2017
Messages
70
I have a dataset with numerous combinations of alpha and numeric values in a given column.

I need to do TWO things.

1) Determine if the 1st character is numeric - if so, the initial condition is met.

2) If numeric, is the character between 1 and 9 (greater than 0) - if so, the final condition is met and the record receives a "Pass."

I'm supplying 2 lines of code that seem to work equally well at handling the initial condition.

It's the final condition that's giving me pain...

Thanks in advance!

Code:
=IF(ISERR(LEFT(AO3,1)*1),"ERROR","OK")

=IF(ISNUMBER(VALUE(LEFT(AO3,1))),"OK","ERROR")
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
Perhaps this:

=IF(ISNUMBER(LEFT(AO3,1)*1),IF(LEFT(AO3,1)*1>0,"OK","ERROR"),"ERROR")

Or

=IF(AND(ISNUMBER(LEFT(AO3,1)*1),LEFT(AO3,1)*1>0),"OK","ERROR")
 
Last edited:
Upvote 0
Similarly,

[Table="width:, class:grid"][tr][td="bgcolor:#C0C0C0"][/td][td="bgcolor:#C0C0C0"]
A​
[/td][td="bgcolor:#C0C0C0"]
B​
[/td][td="bgcolor:#C0C0C0"]
C​
[/td][/tr][tr][td="bgcolor:#C0C0C0"]
1​
[/td][td]
123​
[/td][td="bgcolor:#CCFFCC"]OK[/td][td]B1: =IF((LEFT(A1) >= "1") * (LEFT(A1) <= "9"), "OK", "Error")[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
2​
[/td][td]ABCDE[/td][td="bgcolor:#CCFFCC"]Error[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
3​
[/td][td]012[/td][td="bgcolor:#CCFFCC"]Error[/td][td][/td][/tr]
[/table]
 
Upvote 0
Or ...

[Table="width:, class:grid"][tr][td="bgcolor:#C0C0C0"][/td][td="bgcolor:#C0C0C0"]
A​
[/td][td="bgcolor:#C0C0C0"]
B​
[/td][td="bgcolor:#C0C0C0"]
C​
[/td][/tr][tr][td="bgcolor:#C0C0C0"]
1​
[/td][td]
123​
[/td][td="bgcolor:#CCFFCC"]OK[/td][td]B1: =IF(MEDIAN(49, CODE(A1), 57) = CODE(A1), "OK", "Error")[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
2​
[/td][td]ABCDE[/td][td="bgcolor:#CCFFCC"]Error[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
3​
[/td][td]012[/td][td="bgcolor:#CCFFCC"]Error[/td][td][/td][/tr]
[/table]
 
Upvote 0
I know I am late to the party, but here is one more formula that you can consider...

=IF(0+LEFT(A1)>0,"OK","Error")
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,175
Members
453,021
Latest member
Justyna P

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