+ Reply to Thread
Results 1 to 10 of 10

Returning multiple distinct/repeating values for vlookup or index-match

  1. #1
    Registered User
    Join Date
    05-20-2013
    Location
    Colorado, US
    MS-Off Ver
    Excel 2011 Mac
    Posts
    2

    Returning multiple distinct/repeating values for vlookup or index-match

    Hello everyone, first time poster and rookie excel user.

    I am trying to create either a vlookup formula or a index match formula to match a specific id number with a corresponding location code stored on a separate worksheet within the same workbook, however each unique id may have one or more locations associated with it and it may also have multiples of the same location numbers associated with it. I would like the workbook to return all values in adjacent cells. Is there a way to do that? I have attempted searches and following previous directions but I have been unable to make it work.

    I am attaching a sample workbook with the data

    I am hoping to have results display in columns G, H, I, ect on the "Match Sheet" based on how many different locations are associated with the specific ID number from the "Data Sheet"

    for example person Id 16209 should return two different location codes, 407 and 210 from the "data sheet" while personid 16284 should return two of the same location codes, 457 and 457

    any help would be greatly appreciated the boss handed this off to me and it seems a bit over my head at the time

    Thank you all in advance.
    Attached Files Attached Files

  2. #2
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: Returning multiple distinct/repeating values for vlookup or index-match

    hi amatvien, welcome to the forum. try this array formula in G2:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    ...confirmed by pressing CTRL-SHIFT-ENTER to activate the array. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL-SHIFT-ENTER you will get an error or a clearly incorrect answer. Press F2 on that cell and try again.

    Thanks, if you have clicked on the * and added our rep.

    If you're satisfied with the answer, click Thread Tools above your first post, select "Mark your thread as Solved".

    "Contentment is not the fulfillment of what you want, but the realization of what you already have."


    Tips & Tutorials I Compiled | How to Get Quick & Good Answers

  3. #3
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Returning multiple distinct/repeating values for vlookup or index-match

    Something else to consider...

    If you don't want to index the entire column and eliminate the offset correction altogether then calculate just a single offset correction instead of an array of offset corrections.

    Put the offset correction outside the SMALL function:

    =IFERROR(INDEX('Data Sheet'!$D$2:$D$451,SMALL(IF('Data Sheet'!$C$2:$C$451=$A2,ROW('Data Sheet'!$C$2:$C$451)),COLUMNS($G2:G2))-ROW('Data Sheet'!$C$2)+1),"")
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  4. #4
    Registered User
    Join Date
    05-20-2013
    Location
    Colorado, US
    MS-Off Ver
    Excel 2011 Mac
    Posts
    2

    Re: Returning multiple distinct/repeating values for vlookup or index-match

    Tony, thank you! That worked perfectly, its calculating exactly what I need.

    One small side issue tho, it has made the workbook virtually unusable, I tried turning off autocalc and it still takes forever to do anything with the data including scrolling around. Is there anything that can be done to speed up the sheet?

    The formula that was suggested is used in 5 columns that are about 800 rows each and is searching a sheet that contains 160K rows of two column data. Is this the most efficient/only way to do this? I'm concerned that once it is complete any reload of the data will cause a crash and render it useless.

    Thanks for you help guys!

  5. #5
    Registered User
    Join Date
    01-18-2012
    Location
    switzerland
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: Returning multiple distinct/repeating values for vlookup or index-match

    Hello,

    I would need your help on he following please.

    in tab : report- I'll choose the country.
    in tab : Extract ESr: data will be changed accordingly to the selection.

    and data will be cleaned in column T-U- V- W.

    I need kind of macro in Column X (or formula), to extract unique value from column W. Without duplicates,

    This will allow me to make a reference in Tab report to put this code into a table without duplicates.

    Just i forget to mentioned that i need the macro to run each time we change the selection of the country.



    Thank you for your help.
    Attached Files Attached Files

  6. #6
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Returning multiple distinct/repeating values for vlookup or index-match

    If you were searching for a single criteria you could use a helper column to mark which rows need to be returned.

    However, you're searching for many crtieria so this makes it very calculation instensive on that many rows of data (each formula having to search through 160k rows and there being 800 formulas! ).

    I don't think there is an efficient formula solution for this. You might want to see if someone can do this in a VBA procedure. It would still take a few minutes to run/process but it should be much faster than a formula and the VBA procedure would only run on demand so you wouldn't have the file recalculating and "freezing up" all the time.

    Unfortunately, I'm not much of a programmer so someone else will need to help you with that.

  7. #7
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Returning multiple distinct/repeating values for vlookup or index-match

    @ketats1...

    The forum owner would prefer that you start your own thread rather than asking your question(s) in someone elses thread.

  8. #8
    Registered User
    Join Date
    01-18-2012
    Location
    switzerland
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: Returning multiple distinct/repeating values for vlookup or index-match

    Sorry for this.

    I'll do

  9. #9
    Registered User
    Join Date
    01-18-2012
    Location
    switzerland
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: Returning multiple distinct/repeating values for vlookup or index-match

    Sorry for this.

    I'll do

  10. #10
    Registered User
    Join Date
    08-21-2018
    Location
    ontario, canada
    MS-Off Ver
    2007
    Posts
    7

    Re: Returning multiple distinct/repeating values for vlookup or index-match

    Hello everyone,

    I know it'S an old question but i have a similar issue regarding payroll.

    Sheet 1 has the input including date, name and order#

    I have 1 sheet for every employee that has a 2 week table in a row and a column for the order#

    I was able to pull all the data with 2 criteria from Input sheet into each employees sheet
    The criteria are range of dates and employee name and the return is all the work# that match those criteria

    I used formula below which is similar to the one listed above:

    =IFERROR(INDEX(Input!$A$2:$H$999, SMALL(IF(COUNTIF($C$22:$O$22, Input!$B$2:$B$999)*COUNTIF($D$10, Input!$D$2:$D$999), ROW(Input!$A$2:$H$999)-MIN(ROW(Input!$A$2:$H$999))+1), ROW(A1)), COLUMN($C$1)), "")

    The problem I'm running into is that it's returning duplicates of the same work#.

    How can I add a function to remove duplicates? I do not want to use the filter function as I want it to be done automatically.

    please help!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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