FIND DATE IN A RANGE

drluke

Active Member
Joined
Apr 17, 2014
Messages
314
Office Version
  1. 365
Platform
  1. Windows
I have a range with dates in B2:C26. I want my formula to find the row range that my reference date in F3 falls into and then
(a) if my reference date is smaller than the start date in the range, return value in col A of the row immediately above it, or
(b) if my reference date is greater than the end date in the range, return value in col A of the row immediately below it, or
(c) if my reference date is greater than or equal to the start date in the range but smaller than or equal to the end date in the range (i.e within the row range) then return value in col A of the same row
In my example the value in G4 should be 08/2021

I found a lot of information about doing each of the actions above on an "individual" basis, but nothing that will find the reference date and do the other actions in one formula. Any help or advice would be appreciated.


Macro FAR2 (version 1).xlsb.xlsm
ABCDEFG
1Per numbStart DateEnd Date
212/202024-Nov-2027-Dec-20
31/202128-Dec-2024-Jan-21Ref DateValue
42/202125-Jan-2121-Feb-2119/08/2021
53/202122-Feb-2128-Mar-21
64/202129-Mar-2125-Apr-21
75/202126-Apr-2123-May-21
86/202124-May-2127-Jun-21
97/202128-Jun-2125-Jul-21
108/202126-Jul-2122-Aug-21
119/202123-Aug-2126-Sep-21
1210/202127-Sep-2124-Oct-21
1311/202125-Oct-2121-Nov-21
1412/202122-Nov-2126-Dec-21
151/202227-Dec-2123-Jan-22
162/202224-Jan-2221-Feb-22
173/202220-Feb-2227-Mar-22
184/202228-Mar-2224-Apr-22
195/202225-Apr-2222-May-22
206/202223-May-2226-Jun-22
217/202227-Jun-2224-Jul-22
228/202225-Jul-2221-Aug-22
239/201022-Aug-2225-Sep-10
2410/202226-Sep-2223-Oct-22
2511/202224-Oct-2220-Nov-22
2612/202221-Nov-2225-Dec-22
271/202326-Dec-2223-Jan-23
282/202324-Jan-2320-Feb-23
29
Sheet1
Cell Formulas
RangeFormula
F4F4=TODAY()
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

How about
Excel Formula:
=INDEX(A2:A28,MATCH(F4,B2:B28,1))
 
Upvote 0
Solution
I found it searching on the net... see if this helps

Excel Formula:
=LOOKUP(2,1/($B$2:$B$28<=F4)/($C$2:$C$28>=F4),$A$2:$A$28)
 
Upvote 0
I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

How about
Excel Formula:
=INDEX(A2:A28,MATCH(F4,B2:B28,1))
Thank you! Works perfectly.
 
Upvote 0
Glad to help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,215,043
Messages
6,122,816
Members
449,095
Latest member
m_smith_solihull

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