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
Solved

Excel - find matching text from array and lookup value

Posted on 2013-10-29
6
545 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
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

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

 
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

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

Suggested Solutions

Drop Down List with Unique/Distinct Values (Part II - ComboBox or ListBox and Data Validation List Bonus!) David Miller (dlmille) Intro This article focuses on delivering unique, sorted lists to list objects (e.g., ComboBox, ListBox) and Dat…
Approximate matching with VLOOKUP and MATCH seems to me to be a greatly under-used technique, and one which is vital for getting good performance out of large lookups. Until recently I would always have advised using an exact match for simplicity an…
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

809 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