Need a formula that looks at the first digit or letter in a cell

I have a column of numbers. Some begin with the digit 8 and the rest begin with other digits. I want to write a formula that will return "2" if the number in column A starts with 8, and "1" if the number in column A starts with a number other than 8.

Is this possible and if so, how please?

1 Answer

Using a combination of the Left and If functions...

=IF(LEFT(A1,1) = "8", 2, 1)

That's assuming you want to number returned as a number... if you want it as a string..

=IF(LEFT(A1,1) = "8", "2", "1")
4

You Might Also Like