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
 

Some videos you may like

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
52,071
Office Version
365
Platform
Windows
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?
 

Richard U

Active Member
Joined
Feb 14, 2006
Messages
377
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))
 

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
52,071
Office Version
365
Platform
Windows
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:

Toadstool

Well-known Member
Joined
Mar 5, 2018
Messages
532
Office Version
2016
Platform
Windows
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>
 

Forum statistics

Threads
1,089,396
Messages
5,408,010
Members
403,177
Latest member
JACKIP82

This Week's Hot Topics

  • help please
    SORRY NOT ANY GOOD AT EXCEL SO HELP WOULD BE MUCH APPRECIATED this formula is in a sheet called ignore...
  • two formulas needed
    Hello, I'll try my best to explain this: First formula needed in Sheet1 cell A2: If Sheet1 cell B2 = Sheet2 cell B2 then return a 1. If not then...
  • Dynamic Counts
    Good afternoon, we are tidying up some data & the data seems to be growing quicker than we are tidying it up! What we confirm (by reviewing it...
  • Help Excel formula eliminate duplicate values and keep only 2 identical rows.
    as picture below column A has a duplicate value. but the values are not the same as the rule. sometimes 4 rows, sometimes 10 rows or 7 or 9...
  • Macro Compile Error Sub or Function not defined
    Hello, I am trying to run macros from a validation list, all macros have been created and run perfectly on there own but I'm getting a compile...
  • Last row combined with Current Region VBA
    I'm generally happy finding the last row of data through something like Lastrow = Cells(Rows.Count, "D").End(xlUp) but I don't always receive data...
Top