+ Reply to Thread
Results 1 to 8 of 8

Vlookup with Multiple Answers in Lookup Cell!

  1. #1
    Registered User
    Join Date
    02-23-2016
    Location
    Raleigh, North Carolina
    MS-Off Ver
    2010
    Posts
    4

    Vlookup with Multiple Answers in Lookup Cell!

    Hello!

    I have been struggling with this, and am hoping somebody out there can help! I have a massive spreadsheet with inspection failures. I am categorizing the failures into different types. Here is what I got:

    "Data Sheet":

    excel feb 23.jpg

    "Criteria Sheet":

    excel2 feb 23.jpg

    As you can see, the vlookup is searching the reason for failure phrases on the data sheet and matching them to the criteria sheet. However, failures that have multiple reasons for failure are not showing up in failure types because vlookup doesn't know how to produce multiple results in a string of text. Can anyone help on how to list multiple vlookup results? I would prefer them to be listed all in the same cell with a comma separating them. I am also open to VBA if need be. Thank you!
    Attached Images Attached Images

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Vlookup with Multiple Answers in Lookup Cell!

    Hi, and welcome to the forum

    Please upload a workbook or a representative cut down copy, anonymised if necessary. It is always easier to advise if we can see your request in its context. Pictures are rarely much use and not many of us want to spend time recreating your workbook when you already have one.

    Show a before and after situation with manually calculated results, explaining which information is data and which is results, and if it's not blindingly obvious how you have arrived at your results some explanatory notes as well.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Registered User
    Join Date
    02-23-2016
    Location
    Raleigh, North Carolina
    MS-Off Ver
    2010
    Posts
    4

    Re: Vlookup with Multiple Answers in Lookup Cell!

    Hello,

    Thank you for the quick response. Here is an attached test workbook, where I have highlighted the column where the correct way to do it can go. Thank you!
    Attached Files Attached Files

  4. #4
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Vlookup with Multiple Answers in Lookup Cell!

    This entered in Data!E2 and filled down will return the value associated with the criteria in Data!C2 from the range in Criteria.
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    You have accomplished the same thing using VLOOKUP. You haven't supplied what you really want returned into Data!column E. Can you supply an example of what exactly you are looking for as it isn't at all evident?
    <---------If you like someone's answer, click the star to the left of one of their posts to give them a reputation point for that answer.
    Ron W

  5. #5
    Registered User
    Join Date
    02-23-2016
    Location
    Raleigh, North Carolina
    MS-Off Ver
    2010
    Posts
    4

    Re: Vlookup with Multiple Answers in Lookup Cell!

    Hello,

    Thanks for responding. Here is exactly what I want;

    In Data's column E, I want it to list all of the failure types present, based on the Criteria list. This is done for those who only have one type of failure. However, for those with more than one (Example, row 4 has 2 reasons for failure), vlookup is unable to provide the type of failure. I want it to list the types of failure (example with row 4: I want failure type(s) to be: Quality Control, Containment). I would like them to be listed in one cell with a comma separating each. I hope that clears it up?

    Thanks

  6. #6
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Vlookup with Multiple Answers in Lookup Cell!

    I don't know why you have multiple reasons entered into one cell. That becomes a nightmare to work with. There is nothing wrong with using VLOOKUP but the data must be set up to be handled correctly. Where there is more than one reaon for failure there should be either another row entered or columns to accommodate more than one reason. In short, one cell per reason.
    Here is your workbook back showing 1 row per reason and makes use of column A on the Criteria worksheet instead of looking up "Question....." against a column of text. Using the number in column A eliminates the possibility of making a lot of errors. In addition, using full column references isn't a good idea especially if the data becomes long. I converted the Criteria data to a table and gave the table a name called Failures and used that in the formulae.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    02-23-2016
    Location
    Raleigh, North Carolina
    MS-Off Ver
    2010
    Posts
    4

    Re: Vlookup with Multiple Answers in Lookup Cell!

    1. Unfortunately, my Data tab is automatically generated from an online database. I don't have time to go through and separate each reason into its own row (I wish I could, as that would make this a simple problem). That is why I am trying to pull the failure types directly from what is given, as it would save myself and the 50 other users a lot of time.

    2. I tried using just the question numbers before, but unfortunately is has errors in itself. For example doing a vlookup for "4" is skewed because it counts 14, 24, 34, 40-49, etc. Using the phrase is more consistent because it is specific to each type of failure.

    I was thinking this was more of a VBA kind of question, as I have found no way for excel to accomplish what I am after.

  8. #8
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Vlookup with Multiple Answers in Lookup Cell!

    I think that your problem with using the numbers is that in your VLOOKUPs in the workbook, you are using wildcards. If you use the numbers, no wildcards should be used.

    Column C, Reason for Failure, is quite inconsistent. Elements of the Question are missing and some commas are missing. You will see what I mean if you select column C and use Text To Columns with COMMAS as the delimiters. If that data was pristine, it would be a simple matter to separate the reasons into separate columns. Even that has problems because you don't know how many columns that will be required as there are instances where there are more than 2 or 3 reasons.

    A reliable formula to straighten this out is in my opinion not likely.

    A possible VBA solution could extract the Question numbers from the text in column C and those numbers could be used to lookup the descriptions from the Criteria worksheet. This is something that I can't do for you.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Vlookup Multiple answers and place in label captions
    By jamie030489 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-13-2015, 11:09 AM
  2. Lookup Formula to Pull Multiple Answers to a Row
    By RG Series in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 07-02-2014, 04:57 PM
  3. [SOLVED] VLOOKUP returning multiple answers from table
    By Cyclewench in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 04-06-2013, 03:18 AM
  4. Return Multiple answers with vlookup?
    By JohnXDoe in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-11-2008, 08:34 AM
  5. Multiple Lookup answers
    By roasty_1 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-16-2007, 09:45 AM
  6. Replies: 0
    Last Post: 01-10-2006, 10:28 AM
  7. Can VLOOKUP return multiple answers based on several identical lo.
    By jddtct in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-11-2005, 03:06 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1