Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


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
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

715 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