ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Searching a cells contents? (https://www.excelbanter.com/excel-worksheet-functions/155113-searching-cells-contents.html)

SteW

Searching a cells contents?
 
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?

JE McGimpsey

Searching a cells contents?
 
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")


In article ,
SteW wrote:

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?


SteW

Searching a cells contents?
 
Awesome.
Thank you very much! :-)

"JE McGimpsey" wrote:

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")


In article ,
SteW wrote:

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?




All times are GMT +1. The time now is 12:14 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com