ISNUMBER

J

johnrb7865

Hi, does anyone know the best way to test if the 1st character in a cell in a
number or a letter in an IF statement? I tried =IF(ISNUMBER(MID(A1,1,1)),do
this if true, do this if false where A1 could be a202 or 202 and it didn't
work. I clearly don't understand the ISNUMBER command. I even tried it alone
=ISNUMBER(MID(A1,1,1) where A1 was a202 and 202 and they both came back
FALSE. Any ideas?

Thanks,
John
 
P

Per Jessen

Hi, does anyone know the best way to test if the 1st character in a cell in a
number or a letter in an IF statement? I tried =IF(ISNUMBER(MID(A1,1,1)),do
this if true, do this if false where A1 could be a202 or 202 and it didn't
work. I clearly don't understand the ISNUMBER command. I even tried it alone
=ISNUMBER(MID(A1,1,1) where A1 was a202 and 202 and they both came back
FALSE.  Any ideas?

Thanks,
John

Hi John

=isnumber(A1)

will return true if A1 contains a number, otherwise it returns false.

Regards,
Per
 
J

Joel

Mid returns a character which is not a number. try this. I used Left
instead orf mid but they are equivalent

=IF(AND(LEFT(A1,1)>="0",LEFT(A1,1)<="9"),TRUE,FALSE)
 
D

Dave Peterson

=mid() will always return text.

=IF(ISNUMBER(-MID(A1,1,1))

If A1 contained A202, then -A would cause an error--not a number.

If A1 contained 202, then -2 (and the minus will coerce the text two to a number
two) and that's a number.
 
G

Geoff K

The reason the formula failed is because the op id not complete the question
IF IsNumber = Something then do this do that. The construction of Mid works
just as well as Left as written.

Geoff K
 
J

johnrb7865

Thanks Joel, that worked great.

John

Joel said:
Mid returns a character which is not a number. try this. I used Left
instead orf mid but they are equivalent

=IF(AND(LEFT(A1,1)>="0",LEFT(A1,1)<="9"),TRUE,FALSE)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top