Search a string for multiple key words

sahrens1

New Member
Joined
Jun 24, 2017
Messages
37
Simple question, that I cannot seem too find. Can anyone help me?

I would like a formula that searches a cell with a sentence for specific keywords. 10 max. If the keyword is found, then it would put the keyword in the cell.

So the cell to be searched would be G6
Keywords would be Theft, harassment, Police, Vandalism and "" (blank)

If those keywords were found, it would put in in the formula cell g7.

Any help?
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
Here's a UDF that will do that:
Code:
Function KeywordFIND(r As String) As String
Dim x, y As Long
x = Array("Theft", "Harassment", "Police", "Vandalism")
For y = LBound(x) To UBound(x)
    If InStr(1, r, x(y), vbTextCompare) Then KeywordFIND = KeywordFIND & x(y) & " "
Next
If Len(KeywordFIND) Then KeywordFIND = Left(KeywordFIND, Len(KeywordFIND) - 1)
End Function


Excel 2010
AB
1Theft harassment Other wordsTheft Harassment
Sheet1
Cell Formulas
RangeFormula
B1=keywordfind(A1)
 
Upvote 0
Try

=IFERROR(LOOKUP(2^15,SEARCH($D$1:$D$4,$G6),$D$1:$D$4),"")

D1:D4 is your list of keywords

IMPORTANT: There cannot be any blanks in D1:D4.
 
Last edited:
Upvote 0
I had interpreted it that there could be multiple keywords in the phrase and thus multiple results.
 
Upvote 0

Forum statistics

Threads
1,223,897
Messages
6,175,270
Members
452,628
Latest member
dd2

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