You are here:

Excel/MATCHing a date within a range of dates

Advertisement


Question
Bob, I hope I can explain this clearly.

I have a list of names in column B, amounts in column C, and dates in column D. Entries can be repeated in any column.

Then in column A, I concatenate each row.

I would like to MATCH name&amt&date in column A. HOWEVER.....the date can vary from 5 days before to 5 days after.

So my question is: how can I MATCH("DOG"&23.54&42385,$A$2:$A$100,0) so that it returns the location in A of an entry with DOG, 23.54, and the first date within 42380-42391?

SUMPRODUCT? Array formula? Something else?

I'm using Excel 2003, and want a formulaic solution. Not VBA.

Thanks for your help.

Answer
If the desired date is in cell H2, for example, then this formula works (MUCH better to use a VBA solution). Enter this in D2 and fill down:

=IF(ISNA(MATCH("Bob"&23.45&(H2-5),$A$1:$A$100,0)),"",MATCH("Bob"&23.45&(H2-5),$A$1:$A$100,0))&IF(ISNA(MATCH("Bob"&23.45&(H2-4),$A$1:$A$100,0)),"",MATCH("Bob"&23.45&(H2-4),$A$1:$A$100,0))&IF(ISNA(MATCH("Bob"&23.45&(H2-3),$A$1:$A$100,0)),"",MATCH("Bob"&23.45&(H2-3),$A$1:$A$100,0))&IF(ISNA(MATCH("Bob"&23.45&(H2-2),$A$1:$A$100,0)),"",MATCH("Bob"&23.45&(H2-2),$A$1:$A$100,0))&IF(ISNA(MATCH("Bob"&23.45&(H2-1),$A$1:$A$100,0)),"",MATCH("Bob"&23.45&(H2-1),$A$1:$A$100,0))&IF(ISNA(MATCH("Bob"&23.45&(H2),$A$1:$A$100,0)),"",MATCH("Bob"&23.45&(H2),$A$1:$A$100,0))&IF(ISNA(MATCH("Bob"&23.45&(H2+1),$A$1:$A$100,0)),"",MATCH("Bob"&23.45&(H2+1),$A$1:$A$100,0))&IF(ISNA(MATCH("Bob"&23.45&(H2+2),$A$1:$A$100,0)),"",MATCH("Bob"&23.45&(H2+2),$A$1:$A$100,0))&IF(ISNA(MATCH("Bob"&23.45&(H2+3),$A$1:$A$100,0)),"",MATCH("Bob"&23.45&(H2+3),$A$1:$A$100,0))&IF(ISNA(MATCH("Bob"&23.45&(H2+4),$A$1:$A$100,0)),"",MATCH("Bob"&23.45&(H2+4),$A$1:$A$100,0))&IF(ISNA(MATCH("Bob"&23.45&(H2+5),$A$1:$A$100,0)),"",MATCH("Bob"&23.45&(H2+5),$A$1:$A$100,0))
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

Excel

All Answers


Answers by Expert:


Ask Experts

Volunteer


Bob Umlas

Expertise

I`m a Microsoft Excel MVP (Most Valuable Professional) and have been since the inception of the program in 1995. I can answer every kind of Excel question except: API, Importing/exporting to other programs (powerpoint, word,...) Also check out my in-person training link at http://www.thumbtack.com/ny/new-york/excel-training/

Experience

Worked with MS Excel since version 0.99 (on the Mac!). Was contributing editor to Excellence Magazine, having written >300 articles. John Walkenbach said of me "I finally met someone who knows as much about Excel as I do."

Publications
Excellence, The Expert, Microsoft

Education/Credentials
BA in math, Hofstra University, 1965

Awards and Honors
MVP
Led sessions for the Convergence 2004-2006 seminar on Excel tips & tricks

©2016 About.com. All rights reserved.