Text and Numeric Conditions

S

swaidan

If I have the following in an excel sheet:

7GH467
8SE65D
59FRS5
6ZSHES

I need a formula that would meet the following conditions:

if the first character is equal to 7 or 8 and the second is a letter to
give me 1.
if the first character is any number other than 7 or 8 and the second
is any letter to give me 2
if the first and second characters are any 2 numbers to give me 3.

Thanks for any help.
 
M

Mark Lincoln

This evaluates an entry in cell A1:

=IF(ISNUMBER(VALUE(LEFT(A1,2))),3,IF(OR(LEFT(A1,1)="7",LEFT(A1,1)="8"),1,2))

Copy down as far as you need.
 
Top