Solved

Excel - find matching text from array and lookup value

Posted on 2013-10-29
6
509 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
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Convert between Excel file formats (.XLS, .XLSX, .XLSM) with/without macro option David Miller (dlmille) Intro Over this past Fall, I've had the opportunity to see several similar requests and have developed a couple related solutions associate…
How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
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…
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.

746 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now