help search text string based upon list of keywords

futurejock

New Member
Joined
May 31, 2009
Messages
20
Hi I need a formula that will use a column list of words as "find text," and the formula will tell me if any instance of any keyword in that list occurs anywhere in a single cell text string. Any word only needs to occur, it doesn't matter how many or which or where.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:eek:ffice:eek:ffice" /><o:p></o:p>
<o:p> </o:p>
The formula also needs to tell me “no” or indicate even with a blank there was no instance.<o:p></o:p>
<o:p></o:p>
It needs to be not case sensitive. I also want exact matches only.<o:p></o:p>
<o:p></o:p>
For instance if:<o:p></o:p>
<o:p></o:p>
Referencing a list sheet1!A1:E1<o:p></o:p>
now<o:p></o:p>
dog<o:p></o:p>
cow<o:p></o:p>
crow<o:p></o:p>
corn<o:p></o:p>
<o:p></o:p>
I have a column of sentences in column B, <o:p></o:p>
but want to check each cell individually<o:p></o:p>
and sentence in B1 cell is:<o:p></o:p>
"The farmer plowed the snow with his dog"<o:p></o:p>
<o:p></o:p>
I'd like C1 to say: "yes". Because the keyword "dog" is in the cell's text string. (or actually it would be great if it could return a word of my choosing. But y/n, true/false will do.)<o:p></o:p>
<o:p></o:p>
if the sentence says:<o:p></o:p>
"The farmer plowed the snow with his doG"<o:p></o:p>
I want the same answer: yes<o:p></o:p>
<o:p> </o:p>
if the sentence says:<o:p></o:p>
"The farmer plowed the snow with his doG and his crow but the cat stayed in the corn for now"<o:p></o:p>
I want the same answer: yes<o:p></o:p>
<o:p> </o:p>
<o:p></o:p>
if the sentence says:<o:p></o:p>
"The farmer plowed the snow with his John Deere"<o:p></o:p>
No keywords were used. I need to make sure the formula doesn't return "yes" on the instance that the keyword "now" (from the list) is part of the word "snow"<o:p></o:p>
<o:p> </o:p>
Also suppose the keyword list did not include the word "now," but instead said “ow,” I'd need the return to NOT say yes on the instance that the “ow” can be found in “snow” and “plowed.” Also in the absence of “ow” from the list, I’d need “cow” and crow” NOT to return the "ow" combination found in the sentence.<o:p></o:p>
<o:p></o:p>
It would be a bonus if I could add words to this list and have the formula include automatically the new words, and data automatically update.<o:p></o:p>
<o:p></o:p>
It would be a bonus I could manually adjust the formula to include additional searches for single keywords from other columnrows of text data. As in if it could do the above, plus add if the word duck appears in text from columnrow Z1, (same row as the cell in question), and even if no key words are in the cell string, also say "yes."<o:p></o:p>
<o:p></o:p>
Thanks,<o:p></o:p>
<o:p></o:p>
Dan
 
if the exclusion list takes precedance over the inclusion list, then you can use the same formula, just nested in an IF statement:

Rich (BB code):
=IF(ISNUMBER(LOOKUP(9.99999999999999E+307,
   SEARCH(" "&ExclusionWords&" "," "&D1&" "))),"No",
    IF(ISNUMBER(LOOKUP(9.99999999999999E+307,
     SEARCH(" "&KeyWords&" "," "&D1&" "))),"Yes","No"))

SEARCH is Not case-sensitive
FIND IS case-sensitive
 
Upvote 0

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
and also would be useful; or even if the previous can't be done:

I would use a formula that requires inclusion of one unique keyword, and then returns yes, but returns no if any instance from a dynamic list occurs.

Dan

Assuming that you define IncludeList and ExcludeList in an approprate manner, define also BigNum as referring to:

=9.99999999999999E+307

Invoke:
Rich (BB code):
=LOOKUP(BigNum,CHOOSE({1,2,3},1,
   LOOKUP(BigNum,SEARCH(" "&IncludeList&" "," "&B1&" ")),
   LOOKUP(BigNum,SEARCH(" "&ExcludeList&" "," "&B1&" "))),
    {"no","yes","no"})
 
Last edited:
Upvote 0
HI SL,

I seem to have lost the thread for "messy" workaround code I need for excel 2003.

do you have / is it still in the thread (do you think?)

It's weird I thought I'd used Aladins formula with your suggestions and it had done well, and cannot get it to work now, so I guess I was in 2007 version?

Anyway sorry I am kind of lost.

D
 
Upvote 0
HI Alladin, and SwingL,

Sorry about and never mind the whining: my last message.

I figured it out. Another variable I'd changed was in the way.

So now feeling good.

Off to test the nested.

D
 
Upvote 0

Forum statistics

Threads
1,215,461
Messages
6,124,957
Members
449,200
Latest member
indiansth

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