Index and Match - with 2 criteria AND a date range...

tylerfutures

New Member
Joined
Nov 22, 2017
Messages
4
Hello,
I have a doozy here and any and all help is truly appreciated.

I am trying to create an Index and Match function that is looking for 2 criteria - a user ID and a date within a range. I have created this array that is looking for the user ID and the specific date:

=INDEX(Sheet2!$I:$I,MATCH(1,(Sheet2!$F:$F=D4)*(Sheet2!$D:$D=J4),0))

It works fine (the first part is looking for the user ID, D4, and the second is looking for the dates - J4 is the date, Sheet2!$D:$D has the dates it is looking through). What I am finding is the dates in Sheet2!:$D:$D may be a few days before or after. What I'd like to do is create something that allows J4 to either be 7 days before or after and return a value. I also need the first part of the function where it is matching user ID.

Any and all help is appreciated. Thank you!
 

Some videos you may like

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying

steve the fish

Well-known Member
Joined
Oct 20, 2009
Messages
7,882
Office Version
365
Platform
Windows
You could do this:

=INDEX(Sheet2!$I:$I,MATCH(1,(Sheet2!$F:$F=D4)*(Sheet2!$D:$D>=J4-7)*(Sheet2!$D:$D < J4+8),0))<j4+8),0))< html=""></j4+8),0))<>
 
Last edited:

Forum statistics

Threads
1,089,428
Messages
5,408,164
Members
403,188
Latest member
Sanjana Ramesh

This Week's Hot Topics

  • help please
    SORRY NOT ANY GOOD AT EXCEL SO HELP WOULD BE MUCH APPRECIATED this formula is in a sheet called ignore...
  • two formulas needed
    Hello, I'll try my best to explain this: First formula needed in Sheet1 cell A2: If Sheet1 cell B2 = Sheet2 cell B2 then return a 1. If not then...
  • Dynamic Counts
    Good afternoon, we are tidying up some data & the data seems to be growing quicker than we are tidying it up! What we confirm (by reviewing it...
  • Help Excel formula eliminate duplicate values and keep only 2 identical rows.
    as picture below column A has a duplicate value. but the values are not the same as the rule. sometimes 4 rows, sometimes 10 rows or 7 or 9...
  • Macro Compile Error Sub or Function not defined
    Hello, I am trying to run macros from a validation list, all macros have been created and run perfectly on there own but I'm getting a compile...
  • Last row combined with Current Region VBA
    I'm generally happy finding the last row of data through something like Lastrow = Cells(Rows.Count, "D").End(xlUp) but I don't always receive data...
Top