You are here:

# Excel/index and martch formula

Question

sample image index and
Hi Tom

I have a range containing information (D2:P7).  In row 2, from E2 onwards, are the months of the year. In column D from D3:D7, are the names of students.  In range E3:P7 are scores for students in a particular month.  So, cell G4 would contain the score for a student in March.

I am trying, without success, to write a formula that will index and match a student (written in cell A3) with a month (written in cell B3)

So that, if I write, say Joseph in cell A3 and September in cell b3, the score for Joseph in  September wil appear in cell C3.

Could you help me with this please?

Chris M

Chris M.

c3:  =INDEX(\$E\$3:\$P\$7,MATCH(\$A\$3,\$D\$3:\$D\$7,0),MATCH(\$B\$3,\$E\$2:\$P\$2,0))

So we can find what column in the Index range by matching the month to the range of months in E2:P2.  This will be the third argument to the INDEX function.

In the second argument, we lookup the name in A3 in the range of names D3:D7.

So in your example, the above formula resolves to

=Index(E3:P3,3,9)

then this picks out the number in M5 that is 25.

Formula was tested and worked for me.

You can suppress error messages by doing

c3:  =IFERROR(INDEX(\$E\$3:\$P\$7,MATCH(\$A\$3,\$D\$3:\$D\$7,0),MATCH(\$B\$3,\$E\$2:\$P\$2,0)),"")

Tested in Excel 2013 and worked for me.  Should work in Excel 2007 to current version.  Just the base formula first shown should work in all versions. (IFERROR introduced in Excel 2007)

--
Regards,
Tom Ogilvy
Questioner's Rating
 Rating(1-10) Knowledgeability = 10 Clarity of Response = 10 Politeness = 10 Comment Perfect. Thank you.

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

#### Tom Ogilvy

##### Expertise

Selected as an Excel MVP by Microsoft since 1999. Answering Excel questions in Allexperts since its inception in 2001. Able to answer questions on almost all aspects of Excel's internal capabilities. If seeking a VBA solution, please specify that in your question itself so I give you the answer you want. [Excel has weak protection - if you are distributing an application, I don't answer questions on how to protect your project from your users.]

##### Experience

Extensive experience.

Education/Credentials
Master of Science (MS) degree Operations Research (ORSA)

Awards and Honors
Microsoft MVP in Excel.