Searching cells to see if it contains multiple text strings

Dannytt93

New Member
Joined
Feb 13, 2019
Messages
9
Hello,

I am trying to search a cell to see if it contains an abbreviation for job title.. if it contains the abbreviation, i want it to put in the full job title which is reference in another cell.

I have got it working for one text cell by the following:

=IF(ISNUMBER(SEARCH("Abbreviation1",$A5)),Full title cell1)

I want to run the formula so that if it contains abbreviation2, it will insert full title cell2 and so on....

I tried this:

=IF(AND(ISNUMBER(SEARCH("abbreviation1,$A5)),Full Title cell1), ((Abbreviation2,$A5),Full title cell 2)

but it doesn't work.

Any help anyone is able to provide would be greatly appreciated..

Kind Regards
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Are you looking for the cell to contain BOTH of the abbreviations, or just either one?
How many different values will you be searching for?
Is a VBA solution acceptable?
 
Upvote 0
I don't think you want the and in there, instead a nested if would work better, try:

=IF(ISNUMBER(SEARCH("abbreviation1",$A5)),Full Title cell1,IF(ISNUMBER(SEARCH(abbreviation2,$A5)),"Full Title cell2",somedefaultvalue))
 
Upvote 0
I don't think you want the and in there, instead a nested if would work better, try:
Yes, that is why I questioned if they are looking for both words contained in a single cell (that is the only time it would make sense to try to incorporate "AND").

The solution Richard posted should work if there are only two options, and you could extend it out similarly for a few more options. However, if you have a lot of options, that formula is going to get to be quite long and cumbersome, and that is where you might want to look at an alternative solution like VBA.
 
Last edited:
Upvote 0
I'm reading the requirement as having several possible abbreviations so I think a list of abbreviation/full title may be necessary.

Here I'm using SUBSTITUTE to make the change. You do have to be careful the abbreviation may not be a part of another word (as in row 6).

BCDEFG
1OriginalSUBSTITUTEAbbreviationFull
2Charlie Prof. of EconomicsCharlie Professor of EconomicsProf.Professor
3Bert the BinmanBert the Refuse Disposal ExecutiveProfProfessor
4John is PA to the CEOJohn is Personal Assistant to the CEOFtrDiesel Fitter
5Alf is professionalAlf is professionalBinmanRefuse Disposal Executive
6Alf is ProfessionalAlf is ProfessoressionalPAPersonal Assistant
7CowboyBovine Management Consultant

<colgroup><col style="width: 25pxpx"><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet1

Worksheet Formulas
CellFormula
C2
=IFERROR(SUBSTITUTE(B2,INDEX($F$2:$F$99,AGGREGATE(15,6,ROW($F$2:$F$99)-ROW($F$1)/(FIND($F$2:$F$99,B2)),1)),INDEX($G$2:$G$99,AGGREGATE(15,6,ROW($F$2:$F$99)-ROW($F$1)/(FIND($F$2:$F$99,B2)),1))),B2&"")

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>
 
Upvote 0

Forum statistics

Threads
1,214,798
Messages
6,121,636
Members
449,043
Latest member
farhansadik

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