You are here:

# Excel/Index Match function

Question
Hi Tom,
I am using an Index and Match function to find a date that is referenced by a particular number.

=INDEX(C:C,MATCH(myValue,D:D,0),1)

Column C is the row of dates, and D is the column of values.

I'd like to refine the C:C to only reference the dates of this week.

Do you have any suggestions?

Thanks for the help

Jesse,

I have revised my answer - I was rushing and didn't get all the arguments correct in my formula.

if your dates are sorted and the date only appears once (7 rows per week), you could find your beginning of the week date in column C using match

=Offset(C1,Match(WeekStartDate,C:C,0)-1,0,7,1)

that finds the first row and then uses 7 rows. So you would use that same approach in both parts of your formula

=INDEX(Offset(C1,Match(WeekStartDate,C:C,0)-1,0,7,1),MATCH(myValue,Offset(D1,Match(WeekStartDate,C:C,0)-1,0,7,1),0),1)

so the arguments to offset are

offset(base cell, 0 based row offset, 0 based column offset, number of rows, number of columns)

since the offsets (arguments 2 and 3) are zero based, I subtract 1 from the results of match and the 3rd argument is 0 so it refers to the base cell column.

-- Regards, Tom Ogilvy
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.