Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Find words from a list in text of another column and return matching word if found

Posted on 2013-12-31
Medium Priority
Last Modified: 2013-12-31

I have a list of words in a column e.g. names of fruit in A2:A8


And I have a column of rows of text that may or may not contain one of the words in the list. e.g. Comments in Col. C

My favorite fruit is apples.
Oranges are a good source of vitamin C.
Ripe pears taste good but so do bananas.
My favorite pet is a dog.

If one of the words in Fruits is found in the text, I want to enter the matching word in a cell in Col B, else leave it blank.

I'll take the first occurrence of a match.

What is a good way to do this?

Thanks in advance!
Question by:bobinorlando
  • 2
  • 2
LVL 50

Accepted Solution

barry houdini earned 2000 total points
ID: 39748705
Hello bobinorlando,

One way to do that is with this formula in B2 copied down


It actually matches in reverse order of the fruit in A2:A8 so for the text with "Pears" and "Bananas" it returns "Bananas" because that's lower down the list......is that a problem?

If so you can use this alternative (in Excel 2010 or later versions)


that will match with the first fruit in the text so will give you "Pears" for the text "Ripe pears taste good but so do bananas"

see examples of both approaches attached

regards, barry

Author Comment

ID: 39749000
I see this works in your example file.
However, I'm having trouble applying it to my actual data (which is not the sample data I provided).

Can you plug some pseudo code into the formula to document what data goes where from my sample? e.g.

=IFERROR(LOOKUP(really big number,SEARCH(wordstofind,CellwithText),wordstofind),"iferrorprintthis")

Author Comment

ID: 39749016
Never mind. I've got it now. Thanks!
LVL 50

Expert Comment

by:barry houdini
ID: 39749149
Hello bobinorlando,

Excellent! -yes, this is a perfect generic version

=IFERROR(LOOKUP(really big number,SEARCH(wordstofind,CellwithText),wordstofind),"iferrorprintthis")

regards, barry

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
Windows Explorer let you handle zip folders nearly as any other folder: Copy, move, change, and delete, etc. In VBA you can also handle normal files and folders, but zip folders takes a little more - and that you'll find here.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

571 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question