Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Excel - find matching text from array and lookup value

Posted on 2013-10-29
6
Medium Priority
?
597 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
  • 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 23

Accepted Solution

by:
NBVC earned 2000 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

If you need to forecast numbers -- typically for finance -- the Windows and Mac versions of Excel 2016 have a basket of tools to get the job done.
Windows Explorer lets you open cabinet (cab) files like any other folder. In VBA you can easily handle normal files and folders, but opening and indeed creating cabinet files takes a lot more - and that's you'll find here.
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

971 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