Nested MID and FIND - OR?

B

Brenda

Hello all!

Does anyone know how I may be able to search a string and extract text from
it using the MID and FIND function with multiple FINDS? I have a spreadsheet
for which I have a lengthy bit of text for which I have set up to currently
extract ",IE". I need to adapt the formula
=MID(Dump!A1,FIND(",IE.",Dump!A1)-2,5) to also search for either ",MA" or a
",MC". These characters will always be unique and there will not be a
combination of either in the text string. The string will have either one of
the three but not two or all of them. I thought there may be an OR function
I could use but am having no luck.

Thank you for your time any any help you may be able to provide.
 
P

Pete_UK

First of all, I prefer to use SEARCH rather than FIND because FIND is
case-sensitive, although that might be important to you. Here's one
way of doing it:

=IF(ISNUMBER(SEARCH(",IE.",Dump!A1)),MID(Dump!A1,SEARCH(",IE.",Dump!
A1)-2,5),"")& IF(ISNUMBER(SEARCH(",MA",Dump!A1)),MID(Dump!A1,SEARCH
(",MA",Dump!A1)-2,5),"")& IF(ISNUMBER(SEARCH(",MC",Dump!A1)),MID(Dump!
A1,SEARCH(",MC",Dump!A1)-2,5),"")

All one formula - hopefully you can see how it could be extended to
include other conditions.

Hope this helps.

Pete
 

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