+ Reply to Thread
Results 1 to 5 of 5

Index Match with multiple results

  1. #1
    Registered User
    Join Date
    08-30-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2007
    Posts
    78

    Index Match with multiple results

    Hi all,

    I have two data sets; one is a client data set and the other is an episode data set.

    Each client can have up to four programs that they can, legally, access at any one time.

    What I need is to take the client code from the first data set and match it with the second data set that lists what program has been accessed by a specific client over the prior three months.


    Both data sets update each month with tens of thousands of records in each data set.


    What I want is to be able to produce a spreadsheet which says that client xxxxx has utilized these program(s) in the past three months. That may be one program, it could be two programs or up to four different programs.

    If I could get the result to display in four separate columns (marked PRGCode1, PRGCode2 etc) that would be great. I tried that using the columns function but couldn't make it work.


    I've attached a sample - you will see that my attempt at the formula is in column B but with mostly errors.


    Any help in achieving the outcome would be greatly appreciated.
    Attached Files Attached Files

  2. #2
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Index Match with multiple results

    In B2, enter this ARRAYED formula
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    **Array formulas are not entered in the same way as 'standard' formulas. Instead of pressing just ENTER, you first hold down CTRL and SHIFT, and only then press ENTER. If you've done it correctly, you'll notice Excel puts curly brackets {} around the formula (though do not attempt to manually insert these yourself).
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Forum Expert
    Join Date
    07-06-2004
    Location
    Northern California
    MS-Off Ver
    2K, 2003, 2010, O365
    Posts
    1,490

    Re: Index Match with multiple results

    Standard question for situations like this: why aren't you using a database for this?

    Given your sample workbook, try

    B2:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Copy B2, select B2:E16, and paste.

  4. #4
    Registered User
    Join Date
    08-30-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2007
    Posts
    78

    Re: Index Match with multiple results

    Hi hringrv,

    that array formula has worked perfectly - and I don't know how.

    In terms of using a database - the data comes from two different databases through an SQL query. I don't know enough about using a database such as Access to create an automated function that takes the data from these two queries and produces an output file every night for loading into the ERP.


    Would still love to know how that formula works.

  5. #5
    Forum Expert
    Join Date
    07-06-2004
    Location
    Northern California
    MS-Off Ver
    2K, 2003, 2010, O365
    Posts
    1,490

    Re: Index Match with multiple results

    Quote Originally Posted by Wizards View Post
    . . . Would still love to know how that formula works.
    INDEX(($S$2:$S$20<>$A2)*1E+300+(ROW($S$2:$S$20)-CELL("row",$S$2:$S$20)+1),0) returns an array of very large numbers for values in S2:S20 which differ from the value of A2, or row indices in S2:S20 for values in S2:S20 equal to the value of A2. ROW($S$2:$S$20) is an array of row numbers, so {2;3;...;19;20}; CELL("row",$S$2:$S$20) is the row number of the 1st cell in S2:S20, so 2; ROW(...)-CELL(...) is then the array {0;1;...;17;18}, so adding 1 to it makes it the array {1;2;...;18;19}. COLUMNS($B2:B2) is the number of columns in its range argument, so this would be 1; however, as you fill or copy the formula to the right, it adjusts to COLUMNS($B2:C2), COLUMNS($B2:D2), etc, so returns 2, 3, etc. SMALL(p,q) returns the qth smallest value in p; those are row indices for values in S2:S20 equal to the value in A2 or very large numbers for values in S2:S20 differing from the value in A2. INDEX(x,y) returns the yth item in x for 1 <= y <= number of items in x; for very large y, INDEX(x,y) returns a #REF! error. IFERROR(INDEX(...),"") returns nonerror values and replaces error values with "" (zero length string, which appears as blank).

+ 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. Need Help with Index, Match, Match with multiple results and copying data x times
    By jrboyd in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 05-27-2019, 06:57 AM
  2. VBA index Match, multiple RESULTS, Not a UDF
    By atdemeo in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-07-2017, 12:57 PM
  3. Index match multiple results
    By luke_reed in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 04-07-2017, 08:06 AM
  4. [SOLVED] Index Match Multiple results
    By kashifshahzad in forum Excel General
    Replies: 7
    Last Post: 03-21-2017, 11:14 AM
  5. [SOLVED] Sum of multiple index/match results
    By kawaik in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 06-25-2015, 10:03 PM
  6. Index/Match with multiple results
    By kwadjo in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 01-26-2013, 04:05 PM
  7. Index/Match with multiple results
    By amcghee1 in forum Excel General
    Replies: 4
    Last Post: 10-18-2012, 12:15 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