If Statement for text / numbers

brumby

Active Member
Joined
Apr 1, 2003
Messages
400
Hiya all,

Is it possible to have an if type statement to look at the first character of a cell to see if it starts with a number or a text letter?

something like....

=IF(A5="CELL CONTENTS START WITH A NUMBER","A","B")

Is this possible?


Many Thanks
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
Here is one way:
Code:
=IF(AND(CODE(LEFT(A5,1))>=48,CODE(LEFT(A5,1))<=57),"It is a number","It is not a number")
 
Upvote 0
=IF(COUNT(-LEFT(A5)),"A","B")
Clever!
Taking advantage of the fact that COUNT only counts numbers and using a negative to coerce the string of a number to be read as a number...
 
Last edited:
Upvote 0
sorry 1 more request,

If true I want to return a ", yes simple return the character ", I thought i would do that by entering """, but it doesnt work?
 
Upvote 0
Do you mean that if TRUE, you want to simply return that one character?
LEFT(A5,1)
would do that.
 
Upvote 0
You can either use:
""""
or
CHAR(34)
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,990
Messages
6,122,625
Members
449,093
Latest member
catterz66

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