Allocating Date Ranges by Start & End Date

PWH1968

New Member
Joined
Nov 10, 2022
Messages
12
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
Hi All - I have a conundrum that I am hoping you can help me with.

I have Start and End Dates that I want to allocate across a number of columns to show how many Years the dates span.

A​
B​
C​
D​
E​
F​
G​
1
Start Date​
End Date​
Year 1​
Year 2​
Year 3​
Year 4​
Year 5​
2
01.Jan.2022​
31.Dec.2025​
01.Jan.2022 - 31.Dec.202201.Jan.2023 - 31.Dec.202301.Jan.2024 - 31.Dec.202401.Jan.2025 - 31.Dec.2025
<blank>​
3
20.Mar.2022​
31.Aug.2025​
20.Mar.2022 - 19.Mar.202320.Mar.2023 - 19.Mar.202420.Mar.2024 - 19.Mar.202520.Mar.2025 - 31.Aug.2025
<blank>​
4

I know how to allocate the Years using combinations of Text and EDATE formulas etc. what I am struggling with is the end date. For example, in Column G - Row 2 I want the formula to ‘end’ and say that there are no dates for Year 5.

Likewise in Column F - Row 3 there is only 5 months which is fine; and then in Column G - Row 3 there would be no dates.

Please help :)
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
You can review the logic and customize for your requirements.
The headings have real dates like Dec 31, 2022.
Edit the text for your preferences.

T202211a.xlsm
ABCDEFGH
1Start DateEnd Date31-Dec-202231-Dec-202331-Dec-202431-Dec-202531-Dec-2026
21-Jan-2231-Dec-2520220101 - 2022123120230101 - 2023123120240101 - 2024123120250101 - 20251231No dates
5e
Cell Formulas
RangeFormula
D2:H2D2=IF(AND($B2<=EDATE(D$1,-12)+1,$C2>=D$1),TEXT(EDATE(D$1,-12)+1,"yyyymmdd")&" - "&TEXT(D$1,"yyyymmdd"),"No dates")
 
Upvote 0
You may like this version better.
You can format the headings to just year and format the dates in the ranges to your preference.

T202211a.xlsm
ABCDEFGH
1
2Start DateEnd Date01-Jan-202201-Jan-202301-Jan-202401-Jan-202501-Jan-2026
31-Jan-2231-Dec-2520220101 - 2022123120230101 - 2023123120240101 - 2024123120250101 - 20251231No
430-Sep-2431-Aug-25NoNo20240930 - 2024123120250101 - 20250831No
520-Mar-2331-Aug-25No20230320 - 2023123120240101 - 2024123120250101 - 20250831No
5e
Cell Formulas
RangeFormula
D3:H4,D5:G5D3=LET(s,MAX($B3,D$2),e,MIN(EDATE(D$2,12)-1,$C3),IF(e-s>0,TEXT(s,"yyyymmdd")&" - "&TEXT(e,"yyyymmdd"),"No"))
H5H5=LET(s,MAX($B5,H$2),e,MIN(EDATE(H$2,12)-1,$C5),IF(e-s>0,"Yes","No"))
 
Upvote 0
Solution
You may like this version better.
You can format the headings to just year and format the dates in the ranges to your preference.

T202211a.xlsm
ABCDEFGH
1
2Start DateEnd Date01-Jan-202201-Jan-202301-Jan-202401-Jan-202501-Jan-2026
31-Jan-2231-Dec-2520220101 - 2022123120230101 - 2023123120240101 - 2024123120250101 - 20251231No
430-Sep-2431-Aug-25NoNo20240930 - 2024123120250101 - 20250831No
520-Mar-2331-Aug-25No20230320 - 2023123120240101 - 2024123120250101 - 20250831No
5e
Cell Formulas
RangeFormula
D3:H4,D5:G5D3=LET(s,MAX($B3,D$2),e,MIN(EDATE(D$2,12)-1,$C3),IF(e-s>0,TEXT(s,"yyyymmdd")&" - "&TEXT(e,"yyyymmdd"),"No"))
H5H5=LET(s,MAX($B5,H$2),e,MIN(EDATE(H$2,12)-1,$C5),IF(e-s>0,"Yes","No"))
Dave you are an absolute legend - thank you so much for the different options :)
 
Upvote 0

Forum statistics

Threads
1,214,979
Messages
6,122,552
Members
449,088
Latest member
davidcom

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