If text string contains a word defined in an array of search words, then return a defined text

nielsnielsen

New Member
Joined
Sep 6, 2016
Messages
3
Dear all wizards,

I have a list of cells with text strings (notes) and I need to check each cell if it contains a word from the search list. Each note will only contain one of the search words. If a note contain a search word, the function need to return a Level 1 text and a Level 2 text. If a note does not contain any of the search Words, the function must return "No L1" and "No L2".
The note can contain the search word in any part of the textstring and it can contain both letters, numbers and basic signs such as " . - , _ "


Thanks. :)


Example:
ABCDEFGH
1NoteLevel 1Level 2Search wordLevel 1 textLevel 2 text
211SomeTextAAOneFirstAAOneFirst
322SomeText BBOneSecondBBOneSecond
4DD some textTwoFirstCCOneThrid
5Some BD TextNo L1No L2DDTwoFirst
655 SomeText FFTwoThirdEETwoSecond
7Text no lettersNo L1No L2FFTwoThrid
8-No L1No L2

<tbody>
</tbody><colgroup><col><col><col span="4"><col><col><col></colgroup>

Notes in: A2:A7
Return of Level 1 in: B2:B7
Return of Level 2 in: C2:C7
Search words in: F2:F8
Level 1 return text in: G2:G8
Level 2 return text in: H2:H8

-The search words and their return text can be in other sheet...
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
Put this in B2 and drag down column B
=IF(ISNUMBER(SEARCH(F2,A2)),G2,"No L1")

Put this in C2 and drag down column C
=IF(ISNUMBER(SEARCH(F2,A2)),H2,"No L2")
 
Last edited:
Upvote 0
Welcome to Mr Excel

Try this

Formula in B2 copied across to C2 and down
=IFERROR(LOOKUP(9.99E+307,SEARCH($F$2:$F$7,$A2),G$2:G$7),G$8)

Hope this helps

M.
 
Upvote 0
Hi AlphaFrog,

Thanks for your reply. However, this does only work if the search Word is on the same row as the note. So, in this example it only Works for row 1+2, not 4-7
-I also added =IF(ISNUMBER(SEARCH($F$2:$F$7,A2)),$G$2:$G$7,"No L1") - But same result

I need it to search the entire list of search Word, so the row number of note and search Word does not have an influence..


Thanks. :)
 
Upvote 0
Give this a try:
Excel Workbook
ABCDEFGH
1NoteLevel 1Level 2**Search wordLevel 1 textLevel 2 text
211SomeTextAAOneFirst**AAOneFirst
322SomeText BBOneSecond**BBOneSecond
4DD some textTwoFirst**CCOneThrid
5Some BD TextNo L1No L2**DDTwoFirst
655 SomeText FFTwoThrid**EETwoSecond
7Text no lettersNo L1No L2**FFTwoThrid
8*****-No L1No L2
Sheet
 
Upvote 0

Forum statistics

Threads
1,215,800
Messages
6,126,980
Members
449,351
Latest member
Sylvine

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