# Credit card type based on card number

1. ## Credit card type based on card number

Hello,
At work, we use a spreadsheet containing credit card numbers. Based on the card number, we will then enter MC/Visa into another cell if the card is either one of those, or enter AMX if the card number is an American Express number.

Visa cards begin with the number 4. Mastercard begins with the number 5. American Express cards begin with 3.

Unfortunately, we have to enter the entire card number into the cell, can't just enter the first digit.

Is there a way to have cell a3 return "AMX", if a number beginning with 3 is entered into cell A1?
Conversely, can cell A3 return "Visa/MC" if the number beginning with 4 OR 5 is entered into cell A1?

Thanks.

2. ## Re: Credit card type based on card number

hi wlsnopps, welcome to the forum. try:
=IF(LEFT(A1)="3","AMX",IF(OR(LEFT(A1)={"4","5"}),"Visa/MC",""))

3. ## Re: Credit card type based on card number

Another option...

=IF(A1<>"",LOOKUP(LEFT(A1),{"3","4","5"},{"AMX","VISA/MC","VISA/MC"}),"")

4. ## Re: Credit card type based on card number

Thanks benishiryo. That is exactly what I needed. And a very big thanks for answering so quickly.
I'm high-fiving you right now.

There are currently 1 users browsing this thread. (0 members and 1 guests)