Searching a cells contents?

S

SteW

I've got a spreadsheet set up with a code in column A.
The code can have 2 forms, xxAxxxx, or xxBxxxx, where x is a number (eg
12A7586, 34B2875).

In column C, I want a value of 1 or 2, depending on the code type in column A.
Is it possibe to do this automatically, or do I have to go through them
manually?
 
J

JE McGimpsey

One way:

C1: =IF(MID(A1,3,1)="A",1,IF(MID(A1,3,1)="B",2,"Error"))

Or, if the code in A *has* to be either A or B in the third character:

C1: = 2 - (MID(A1,3,1)="A")
 
S

SteW

Awesome.
Thank you very much! :)

JE McGimpsey said:
One way:

C1: =IF(MID(A1,3,1)="A",1,IF(MID(A1,3,1)="B",2,"Error"))

Or, if the code in A *has* to be either A or B in the third character:

C1: = 2 - (MID(A1,3,1)="A")
 

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

Top