Search for any of multiple possible texts within a cell

MichaelTman

New Member
Joined
Apr 21, 2006
Messages
18
I have a column of cells containing various characters, could possibly be numbers, letters or punctuation - and of varying lengths. Each may contain 1 of the following: say, AB, CD, CF, DT, LM for sake of this example. A cell can contain none of these or 1 of these, but never more than 1.

Column might look something like this:

xxxAByz
wCDjkli
aa-aa-aa-DTqrstttt
wxyz

(First contains AB, second CD, third DT and fourth none. A cell could never read ABxxCD.)

What I would like to accomplish is to pull out the 2-letter code and dump it to another cell. Once I have the formula to do this, I'm sure it would be just another small addition to obtain a result of "none" if the 2-letter text did not exist within the cell.

I've tried a series of "Find" functions but my version of Excel will not allow more than 5 or 6 in the same formula - in my actual spreadsheet, the are more than 15 2-letter combinations. In addition, I tried "Search" and "Match" functions, but realized these did not work. Other than splitting the "Find" formulas into separate columns, I'd like to get everything into one column. So, the result of the above example would give me:

AB
CD
DT
none

Any ideas? Thanks in advance.
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
Thanks for the quick reply, but I think I wasn't quite clear. I want to search for 15 different possible "Yoursearchstring" at the same time. In other words, I want to find "AB" or "CD" or "DT", etc. and pull out whichever appears.
 
Upvote 0

Forum statistics

Threads
1,224,586
Messages
6,179,719
Members
452,939
Latest member
WCrawford

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top