Return Reference for date between dates

neodjandre

Well-known Member
Joined
Nov 29, 2006
Messages
950
Office Version
  1. 2019
Platform
  1. Windows
I have this setup

COL A - COL B - COL C
F1 - 01/01/2016 - 31/02/2016
F2 - 01/01/2017 - 31/02/2017
F3 - 01/01/2018 - 31/02/2018
F4 - 01/01/2019 - 31/02/2019

For a specific date that falls within a given period, i wish to return the relevant reference. F1, F2, F3, F4

So e.g. for 30/03/2017 the formula should return F2.

Any help would be much appreciated.
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Your values are column C are not valid dates.
Are they supposed to be?
31/12/16
31/12/17
31/12/18
31/12/19


Will the date ranges always be full years, i.e. 01/01/yyyy - 31/12/yyyy?

Lastly, in what row is the first row (F1) found? Is it on row 1 or row 2 (or some other row) of your worksheet?
 
Last edited:
Upvote 0
Your values are column C are not valid dates.
Are they supposed to be?
31/12/16
31/12/17
31/12/18
31/12/19


Will the date ranges always be full years, i.e. 01/01/yyyy - 31/12/yyyy?

Lastly, in what row is the first row (F1) found? Is it on row 1 or row 2 (or some other row) of your worksheet?

sorry, no the ranges could be any range but the last day of period and first day of next period will always be sequential.

This will be on row 1.
 
Upvote 0
Let's say that your date 30/03/17 is in cell F1, and the range your show above is in cells A1:C4.
Then use this equation:
Code:
=IF(AND(F1>=B1,F1<=C1),A1,IF(AND(F1>=B2,F1<=C2),A2,IF(AND(F1>=B3,F1<=C3),A3,IF(AND(F1>=B4,F1<=C4),A4,""))))
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,240
Members
452,621
Latest member
Laura_PinksBTHFT

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