Closed Thread
Results 1 to 11 of 11

Returning multiple entries with INDEX and MATCH

  1. #1
    Registered User
    Join Date
    05-19-2008
    Posts
    3

    Question Returning multiple entries with INDEX and MATCH

    Hello everyone,

    I'm trying to put together a spreadsheet that gets its data from another Excel file.

    Here is the formula I'm using currently:

    =INDEX([other_file.xls]Sheet_1!$A$2:$A$1000,MATCH($M$1,[other_file.xls]Sheet_1!$E$2:$E$1000,0),1)

    Obviously, the reason I'm not using VLOOKUP is because I have to get data from a cell to the left of the column I'm referencing. This formula works for getting the first matched entry, but I need to retrieve about a dozen other entries from other rows that match.

    I'm not sure how to re-write this so that I can get the other rows. I've been experimenting with IF functions but can't get it to work the way I want.

    Any help would be greatly appreciated. Thanks a lot!

    Jesse A.
    Last edited by jessea; 05-19-2008 at 12:29 PM.

  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
    Hi,

    A formula can only return one value. Try using Data Filter instead.

    HTH

  3. #3
    Registered User
    Join Date
    05-19-2008
    Posts
    3
    How can I use a data filter when I'm pulling values from another file? I'm not sure how to do this.


    Thanks,
    Jesse

  4. #4
    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
    Quote Originally Posted by jessea
    How can I use a data filter when I'm pulling values from another file? I'm not sure how to do this.


    Thanks,
    Jesse
    Hi,

    In exactly the same way as you would filter data within the same workbook. Make sure you have the source workbook open, then starting in the destination workbook make sure you have exactly the same column labels as the source workbook, (you can have fewer but not additional labels), and use the Data-->Filter-->Advanced Filter from the menu, picking the 'Copy to Another Location' option, then click the 'List Range box' drop down arrow which will allow you to navigate over to the source workbook and highlight the range you want to filter (including column labels), then click the drop down arrow again, and in the destination workbook click the drop down arrow for the 'Copy To' option, select the range to which you want to filter the records and click OK.

    If you want to use a filter criteria to select a sub set of your records, then just put the appropriate columns labels in the destination WB with the criteria values underneath them, and use the 'Criteria Range' drop down arrow to select the criteria range.

    HTH

  5. #5
    Forum Expert
    Join Date
    06-18-2004
    Location
    Canada
    MS-Off Ver
    Office 2016
    Posts
    1,474
    Try...

    N1:

    =SUMPRODUCT(--([other_file.xls]Sheet1!E2:E1000=M1))

    O1, confirmed with CONTROL+SHIFT+ENTER, and copied down:

    =IF(ROWS(O$1:O1)<=$N$1,INDEX([other_file.xls]Sheet1!$A$2:$A$1000,SMALL(IF([other_file.xls]Sheet1!$E$2:$E$100=$M$1,ROW([other_file.xls]Sheet1!$E$2:$E$100)-ROW([other_file.xls]Sheet1!$E$2)+1),ROWS(O$1:O1))),"")

    Hope this helps!

  6. #6
    Registered User
    Join Date
    05-19-2008
    Posts
    3
    Try...

    N1:

    =SUMPRODUCT(--([other_file.xls]Sheet1!E2:E1000=M1))

    O1, confirmed with CONTROL+SHIFT+ENTER, and copied down:

    =IF(ROWS(O$1:O1)<=$N$1,INDEX([other_file.xls]Sheet1!$A$2:$A$1000,SMALL(IF([other_file.xls]Sheet1!$E$2:$E$100=$M$1,ROW([other_file.xls]Sheet1!$E$2:$E$100)-ROW([other_file.xls]Sheet1!$E$2)+1),ROWS(O$1:O1))),"")

    Hope this helps!
    Hi Domenic,

    Thanks for your help. I tried putting it into my spreadsheet but it didn't seem to work. I was wondering if you could explain to me what the formula is saying? I'm not very good at these yet...

    Also, what do you mean by "confirmed with CTRL+SHIFT+ENTER"?

    Thank you,
    Jesse

  7. #7
    Forum Expert
    Join Date
    06-18-2004
    Location
    Canada
    MS-Off Ver
    Office 2016
    Posts
    1,474
    Hi Domenic,

    Thanks for your help. I tried putting it into my spreadsheet but it didn't seem to work. I was wondering if you could explain to me what the formula is saying? I'm not very good at these yet...

    Also, what do you mean by "confirmed with CTRL+SHIFT+ENTER"?

    Thank you,
    Jesse
    The formula needs to be confirmed with CONTROL+SHIFT+ENTER, not just ENTER. In other words, enter the formula, press the CONTROL and SHIFT keys down, then while these keys are pressed down press the SHIFT key. If done correctly, Excel will automatically place curly brackets {....} around the formula.

    Hope this helps!

  8. #8
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    jessea,

    Please read forum rules below about cross posting on other forums without posting the link.

    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  9. #9
    Registered User
    Join Date
    08-04-2011
    Location
    Indianapolis, Indiana
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: Returning multiple entries with INDEX and MATCH

    Quote Originally Posted by Domenic View Post
    Try...

    N1:

    =SUMPRODUCT(--([other_file.xls]Sheet1!E2:E1000=M1))

    O1, confirmed with CONTROL+SHIFT+ENTER, and copied down:

    =IF(ROWS(O$1:O1)<=$N$1,INDEX([other_file.xls]Sheet1!$A$2:$A$1000,SMALL(IF([other_file.xls]Sheet1!$E$2:$E$100=$M$1,ROW([other_file.xls]Sheet1!$E$2:$E$100)-ROW([other_file.xls]Sheet1!$E$2)+1),ROWS(O$1:O1))),"")

    Hope this helps!
    Hey,

    I tried to implement this code and I'm having a little bit of trouble. I can make it work if I use an example just like the one provided but when I try to make it fit my database, it doesn't work. Can you please elaborate on what exactly is going on in the formula? What it's doing and the theory behind it? I'm sure that if I have a better understanding of the fundamentals of this formula, I'll be able to make it suit my needs.

    Thank you,
    R

  10. #10
    Registered User
    Join Date
    08-04-2011
    Location
    Indianapolis, Indiana
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: Returning multiple entries with INDEX and MATCH

    I found an answer to my own question, haha.

    http://office.microsoft.com/en-us/ex...001226038.aspx

  11. #11
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326

    Re: Returning multiple entries with INDEX and MATCH

    Your post does not comply with Rule 2 of our Forum RULES. Don't post a question in the thread of another member -- start your own thread. If you feel it's particularly relevant, provide a link to the other thread.

Closed 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