Solved

Excel - find matching text from array and lookup value

Posted on 2013-10-29
6
566 Views
Last Modified: 2013-11-01
Experts, I have a column in excel that contains product descriptions (e.g. Col A)

Some of the descriptions contain specific product attributes that would be useful to have in a separate column. If so, then I would like to extract them and enter them into an adjacent column e.g. Col B).

For simple matches against one or two values I have been using something like this:

=IF(ISNUMBER(SEARCH("*DEED*",UPPER($A2))),"Deeded",IF(ISNUMBER(SEARCH("*MEMBERSHIP*",UPPER($A2))),"Membership",""))

That works great for one or two column values. Now however, I need to perform the same "contains" type of search and then match against a larger list of  values so that if the product description in ColA contains any of the following, then insert the matching word in Col B.

e.g.
Deluxe
Executive
House
Junior
Lockout
Loft
Luxury
Master
Penthouse
Plus
Premium
Presidential
Townhouse

Way too many for nested if formulas.

However, I can't figure out the right combination of other functions to use to solve this by first seeing if any one of the values exists within the text in ColA and if so, entering the one that matches into ColB.

Lookup, Vlookup, Index/Match or ??

Thanks in advance!
0
Comment
Question by:bobinorlando
[X]
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
  • 3
  • 2
6 Comments
 
LVL 8

Expert Comment

by:5teveo
ID: 39609192
try something like search

=IF(COUNT(SEARCH({"Romney","Obama","Gingrich"},C1)),1,"")

if text pattern is located in cell C1 then 1 is returned

<link removed - GaryC123>
0
 
LVL 23

Expert Comment

by:NBVC
ID: 39609363
If you create a table of search values and the terms you want to return adjacent to them, say in X2:Y20

Then use a formula like:

=LOOKUP(10^10,SEARCH($X$2:$X$20,A2),$Y$2:$Y$20)

This should search for the text that is in X2:X20 and find it anywhere in A2, then return the corresponding item from Y2:Y20.
0
 
LVL 1

Author Comment

by:bobinorlando
ID: 39610235
Steveo that only gives me a true or false result whereas I need the result to be which of the values that was the match


NB_VC I couldn't get your solution to work  and I wasn't sure what 10^10 represented.
0
Technology Partners: 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!

 
LVL 23

Accepted Solution

by:
NBVC earned 500 total points
ID: 39611319
Please see the attached.

I have 2 formulas because I am not sure of the actual lookup you want.

The first formula simply looks at list in column X and if any words are found in column A strings, then the keyword is assigned.

The second formula is very similar except it extracts the corresponding code from Y for the matching find.

Is this what you are looking for?

The 10^10 is basically a very large number.  And LOOKUP finds the last match that is smaller than or equal to the this lookup value of 10^10.  The SEARCH() function looks for positions of found items and so returns a number to represent that position or a #VALUE error if not found.  So hoping that there is a single match only, the LOOKUP finds that last and perhaps only numeric result and extracts from that position.
Book2.xls
0
 
LVL 1

Author Comment

by:bobinorlando
ID: 39616762
Gary - LOL don't worry I already checked the other sites before I asked here. And I've been a paying member here for years so not to worry ;)
0
 
LVL 1

Author Closing Comment

by:bobinorlando
ID: 39616767
Absolutely did the trick and I appreciate the explanation.
0

Featured Post

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
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…
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…

728 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