Formula to check a given date in the range of dates and return corresponding value (No VBA)

EmadMassoud

New Member
Joined
Nov 24, 2021
Messages
8
Office Version
  1. 2016
Platform
  1. Windows
I am looking for a Formula to check a specific date (e.g today's date) in a range of Dates (E6:E18 & G6:G18) and return the corresponding value from an array (C6:C18) e.g. Block 6. Can I use INDEX & MATCH or VLOOKUP and which is better and why. Thank you
 

Attachments

  • Capture.PNG
    Capture.PNG
    21.9 KB · Views: 12

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Hi EmadMassoud,

You could just use SUMIFS

Cell Formulas
RangeFormula
E2E2=SUMIFS($C$6:$C$18,$E$6:$E$18,"<="&TODAY(),$G$6:$G$18,">="&TODAY())
F2F2=IF(E2=0,"Today is out of range","")
E7:E18E7=G6+1
G6G6=E6+31
G7:G18G7=E7+27
 
Upvote 0
Below are a couple of other options:
My first thought was that since your dates are consecutive, that you could simply use Vlookup with a True (approximate match). This is ruled out by the fact that you need to look up a column to the left.
You can achieve the same thing using a Index/Match with the match type of less than. The only issue might be if the test date is greater than the 03-Jul-22 in the table put together by Toadstool.
It also would not work if there were breaks in the dates ie the start date did not follow on from the previous end date.

The Lookup will handle multiple criteria in any version of Excel.
If you have 365 you would have more options.


Cell Formulas
RangeFormula
E2E2=SUMIFS($C$6:$C$18,$E$6:$E$18,"<="&TODAY(),$G$6:$G$18,">="&TODAY())
F2F2=INDEX($C$6:$C$18,MATCH(TODAY(),$E$6:$E$18,1),0)
G2G2=LOOKUP(2,1/ (($E$6:$E$18<=TODAY())*($G$6:$G$18>=TODAY())),$C$6:$C$18)
E7:E18E7=G6+1
G6G6=E6+31
G7:G18G7=E7+27
 
Upvote 0
Hi EmadMassoud,

You could just use SUMIFS

Cell Formulas
RangeFormula
E2E2=SUMIFS($C$6:$C$18,$E$6:$E$18,"<="&TODAY(),$G$6:$G$18,">="&TODAY())
F2F2=IF(E2=0,"Today is out of range","")
E7:E18E7=G6+1
G6G6=E6+31
G7:G18G7=E7+27
Hi Toadstool,

Your formula is simple and straightforward

Thank you!
 
Upvote 0
Below are a couple of other options:
My first thought was that since your dates are consecutive, that you could simply use Vlookup with a True (approximate match). This is ruled out by the fact that you need to look up a column to the left.
You can achieve the same thing using a Index/Match with the match type of less than. The only issue might be if the test date is greater than the 03-Jul-22 in the table put together by Toadstool.
It also would not work if there were breaks in the dates ie the start date did not follow on from the previous end date.

The Lookup will handle multiple criteria in any version of Excel.
If you have 365 you would have more options.


Cell Formulas
RangeFormula
E2E2=SUMIFS($C$6:$C$18,$E$6:$E$18,"<="&TODAY(),$G$6:$G$18,">="&TODAY())
F2F2=INDEX($C$6:$C$18,MATCH(TODAY(),$E$6:$E$18,1),0)
G2G2=LOOKUP(2,1/ (($E$6:$E$18<=TODAY())*($G$6:$G$18>=TODAY())),$C$6:$C$18)
E7:E18E7=G6+1
G6G6=E6+31
G7:G18G7=E7+27
Fantastic!

Thanks a lot Alex Blakenburg for the detailed explanation, and for the two additional alternative options!

Personally, I like using INDEX & MATCH combination a lot

Thank you!
 
Upvote 0

Forum statistics

Threads
1,214,999
Messages
6,122,645
Members
449,093
Latest member
Ahmad123098

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top