You are here:

Excel/Using INDEX/MATCH to look up multiple values

Advertisement


Question
QUESTION: I have two worksheet tabs.  A (to be populated) and B (raw data).  I want to populate column A in tab A with all the corresponding matches from tab B.

Formula =INDEX(B!A:A,MATCH($C$1,(B!D:D),0))gives me the first match for $C$1 (drop down cell), but when I copy this formula down, it returns the same first value from the match in tab B.  How can I get this to 'loop' to return all the matches in tab B?

ANSWER: Dale,

Ashish Mathur has documented how to do this on the Microsoft Office support site:

http://office.microsoft.com/en-us/excel/HA012260381033.aspx#Return%20multiple%20...

--
Regards,
Tom Ogilvy



---------- FOLLOW-UP ----------

QUESTION: Thanks Tom,
For the most part that worked.  However, I modified the formula to use with the spreadsheet I have.  Now I am experiencing a 1 off problem.  The result returns 326 rows, when there should be 327 rows of data.  The formula I used is as follows:  

{=IF(ISERROR(INDEX(FSR!$A$2:$S$20000,SMALL(IF(FSR!$D$2:$D$20000=$C$1,ROW(FSR!$D$2:$D$20000)),ROW(326:326)),1)),"",INDEX(FSR!$A$2:$S$20000,SMALL(IF(FSR!$D$2:$D$20000=$C$1,ROW(FSR!$D$2:$D$20000)),ROW(326:326)),1))}

Do you know why it is dropping a row?

Dale

Answer
Dale,

ROW(326:326) tells it to return the 326th largest number.  It looks like you should drag it down 1 more row to get it to go to 327

(so if you started with row(1:1), you only have the formula in 326 cells.

--
Regards,
Tom Ogilvy  
About Excel
This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here

All Answers

Answers by Expert:


Ask Experts

Volunteer


Tom Ogilvy

Expertise

Worked with the program for many years - provided assistance on MS Excel Newsgroups since 1997. Have received the Microsoft MVP award annually since 1999. I don't answer questions on using Excel in a browser Since I have no way to test this. Prefer not to answer charting questions. I consider myself to be particularly knowledgeable about using VBA internal to Excel but have no problems with formulas and pivot tables either.

Experience

Have Used Excel for 15 - 20 years. Answered in excess of 70,000 Excel related questions in MS Excel newsgroups. Unless obvious, please specify whether you want a worksheet function or macro/VBA solution.

Education/Credentials
BS General Engineering (concentration in Industrial Engineering) MS Operations Research Systems Analysis

©2009 About.com, a part of The New York Times Company. All rights reserved.