+ Reply to Thread
Results 1 to 5 of 5

return multiple items for one lookup value for a table

  1. #1
    Forum Contributor
    Join Date
    05-28-2016
    Location
    Australia
    MS-Off Ver
    2013
    Posts
    119

    return multiple items for one lookup value for a table

    I am trying to return multiple items for one lookup value for a table.

    I have a list of staff details in one sheet (From Adobe) that is derived form another simpler set of data in another sheet (Raw Data) within the same workbook. This is done so that raw data can be imported without corrupting conditional formatting in the main working sheet.

    I have created a crude sheet (Vlookup) to retrieve information based on a payroll number or name search. I managed to get exact matches returned.

    My next step is to return the list of all possible matches to a non-exact name search. If I am looking for "Pat" but "Patricia" comes first, I currently get "Patricia"s details. I have included the formula for an array that I have been working on in the uploaded file.

    On the Vlookup Sheet I would like to return the results in cells B12:Q12 and down. I would like this to stop once there are no more matching names.

    I followed the tutorial at https://www.youtube.com/watch?v=Tp7I...pxGa2QYbywKz8O
    If I change the formula from an array formula after using Ctrl + Shift + Enter to a regular formula using Enter the result returned is always the 12th name form the From Adobe sheet.

    The uploaded file has been desensitized by creating random names & details.
    Attached Files Attached Files

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: return multiple items for one lookup value for a table

    The way I handle this is to avoid arrays, which seem fun, but get cumbersome. So, in your scenario where you always only need ONE set of multiple lookup values, I add a KEY column to my data to facilitate this list and keep the workbook at top speed.

    So, on the ADOBE sheet, add a KEY in Q, first formula in Q2, then copied down:
    =IF(ISNUMBER(SEARCH(LookName,C2)),N(Q1)+1,N(Q1))

    Then, on the LOOKUP sheet (change the name from VLOOKUP), the first non-array formula in B12, copied down and across:
    =IF(ROWS(B$12:B12)>$A$4,"",INDEX('From Adobe'!$1:$5000,MATCH(ROWS(B$12:B12),'From Adobe'!$Q:$Q,0),MATCH(B$7, 'From Adobe'!$1:$1, 0)))

    Notice this version is looking at the headers as well, so this means you can organize this new table in any order you want, a superior result. Change a header and the same formula just keeps working.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Forum Contributor
    Join Date
    05-28-2016
    Location
    Australia
    MS-Off Ver
    2013
    Posts
    119

    Re: return multiple items for one lookup value for a table

    That has worked and yes, it is far more elegant. Thank you so much for the fast reply and the solution.
    So I learn from this, what is the purpose of the KEY?
    The formula on the ADOBE sheet appears to workout the data where the KEY changes.
    I certainly need to learn more about index and match.

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: return multiple items for one lookup value for a table

    An INDEX is merely an ordered list of possible values to return, the second INDEX parameter is what position in the index you want to see. So the KEY is creating a unique index number for each match, the repeating numbers are ignored, only the first instance of each key value is used.

    Your COUNTIF already determines only 22 matches exist, so we merely go and retrieve the INDEX value from each of the 22 unique values listed in the new KEY column.

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

  5. #5
    Forum Contributor
    Join Date
    05-28-2016
    Location
    Australia
    MS-Off Ver
    2013
    Posts
    119

    Re: return multiple items for one lookup value for a table

    thank you for all the help and information.

+ 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. [SOLVED] Return Multiple Items with One Lookup Value
    By PMH2384 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-05-2016, 02:42 AM
  2. Replies: 2
    Last Post: 06-09-2015, 11:20 PM
  3. [SOLVED] Multiple Lookup to return value in table
    By CDobby in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-18-2014, 12:25 PM
  4. lookup a single value and return items in multiple columns
    By FredFitzgerald in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 10-20-2014, 03:29 PM
  5. [SOLVED] Return multiple items from two and three lookup values
    By bjnockle in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 09-12-2013, 01:14 PM

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