List all months that are part of a date range?

Meraki22

New Member
Joined
Mar 26, 2025
Messages
3
Office Version
  1. 365
Platform
  1. Windows
Hi

I'm having a problem with getting excel to list all the months and year that are part of a date range between a start and finish date. Below is the example of how I want it to behave (including partial months in it's output).

Desired output


Start
Finish
Output (This Spills out horizontally which is fine)
""indicates the result spills into seperate cells
10/01/2025 01/03/2025 "Jan-25" "Feb-25" "Mar-25"
31/03/2025 01/04/2025 "Mar-25" "Apr-25"
31/03/2025 01/05/2025"Mar-25" "Apr-25" "May-25"

I've tried a few formulars to get this and it works apart from it only returns the month and year if it's at least a full month before the start date

Output I'm getting now

StartFinishOutput
10/01/202501/03/2025"Jan-25" "Feb-25"
31/03/202501/04/2025 "Mar-25"
31/03/202501/05/2025"Mar-25" "Apr-25"

These are the formulars i've tried

Excel Formula:
=IF($C91="", "", IF(SEQUENCE(1, DATEDIF($C91, $E91, "m")+1, 0, 1)<=DATEDIF($C91, $E91, "m")+1, TEXT(EDATE($C91, SEQUENCE(1, DATEDIF($C91, $E91, "m")+1, 0, 1)), "MMM-YY"), IF(AND(MONTH($E91)<>MONTH($C91), YEAR($E91)=YEAR($C91)), TEXT($E91, "MMM-YY"), "")))


Excel Formula:
=IF($C91="", "", TEXT(EDATE($C91, SEQUENCE(1, DATEDIF($C91, $E91, "m")+1, 0, 1)), "MMM-YY"))


I think the issue is the "m")+1 part but i can't for the life of me workout how to fix it (Lots of googling and co-piloting) but i'm just not getting anywhere. any advice would be appreciated.
 

Attachments

  • Screenshot 2025-03-26 163129.png
    Screenshot 2025-03-26 163129.png
    37.4 KB · Views: 4
Hello, maybe something like:

Excel Formula:
=LET(
s,A2,
e,B2,
TEXT(DATE(YEAR(s),SEQUENCE(,MONTH(e)-MONTH(s)+1+(YEAR(e)-YEAR(s))*12,MONTH(s)),1),"MMM-YY"))
 
Upvote 0
This returns dates as values:
Excel Formula:
=LET( bmo, EOMONTH(A1,-1)+1,     emo, EOMONTH(B1,0),     mths, ROUND((emo-bmo)/30,0),
EDATE(bmo,SEQUENCE(,mths,0))
)
 
Upvote 0
T202503a.xlsm
ABCDEFG
1StartFinish
210-Jan-251-Mar-25Jan-25Feb-25Mar-25
331-Mar-251-Apr-25Mar-25Apr-25
431-Mar-251-May-25Mar-25Apr-25May-25
5
6
710-Jan-251-Mar-25Jan-25Feb-25Mar-25
831-Mar-251-Apr-25Mar-25Apr-25
931-Mar-251-May-25Mar-25Apr-25May-25
10
7c
Cell Formulas
RangeFormula
E2:G2,E4:G4,E3:F3E2=TEXT(EDATE(B2,SEQUENCE(1,DATEDIF(B2-DAY(B2),C2,"m")+1,0,1)),"MMM-YY")
E7:G7,E9:G9,E8:F8E7=LET(s,B7-DAY(B7)+1,EDATE(s,SEQUENCE(,DATEDIF(s,C7,"m")+1)-1))
Dynamic array formulas.
 
Upvote 0
Thank you everyone all of the above seem to work perfectly! Thank you!
 
Upvote 0
T202503a.xlsm
ABCDEFG
1StartFinish
210-Jan-251-Mar-25Jan-25Feb-25Mar-25
331-Mar-251-Apr-25Mar-25Apr-25
431-Mar-251-May-25Mar-25Apr-25May-25
5
6
710-Jan-251-Mar-25Jan-25Feb-25Mar-25
831-Mar-251-Apr-25Mar-25Apr-25
931-Mar-251-May-25Mar-25Apr-25May-25
10
7c
Cell Formulas
RangeFormula
E2:G2,E4:G4,E3:F3E2=TEXT(EDATE(B2,SEQUENCE(1,DATEDIF(B2-DAY(B2),C2,"m")+1,0,1)),"MMM-YY")
E7:G7,E9:G9,E8:F8E7=LET(s,B7-DAY(B7)+1,EDATE(s,SEQUENCE(,DATEDIF(s,C7,"m")+1)-1))
Dynamic array formulas.
The example in E2 doesn't seem to work quite right I set Start as 01/01/2025 and finish as 31/03/2025 and it gave Jan - Mar correctly but also Apr. The example in E7 seems to work perfectly though! thank you
 
Upvote 0
T202503a.xlsm
ABCDEFG
1StartFinish
210-Jan-251-Mar-25Jan-25Feb-25Mar-25
331-Mar-251-Apr-25Mar-25Apr-25
431-Mar-251-May-25Mar-25Apr-25May-25
51-Jan-2531-Mar-25Jan-25Feb-25Mar-25
6
710-Jan-251-Mar-25Jan-25Feb-25
831-Mar-251-Apr-25Mar-25Apr-25
931-Mar-251-May-25Mar-25Apr-25May-25
101-Jan-2531-Mar-25Jan-25Feb-25Mar-25
11
7c
Cell Formulas
RangeFormula
E2:G2,E4:G5,E3:F3E2=TEXT(EDATE(B2,SEQUENCE(1,DATEDIF(B2-DAY(B2)+1,C2,"m")+1,0,1)),"MMM-YY")
E7:F7E7=EDATE(B2,SEQUENCE(,DATEDIF(B7,C7,"m")+1)-1)
E8:F8,E9:G10E8=LET(s,B8-DAY(B8)+1,EDATE(s,SEQUENCE(,DATEDIF(s,C8,"m")+1)-1))
Dynamic array formulas.
 
Upvote 0
Solution
T202503a.xlsm
ABCDEFGHIJ
1List of months
2StartFinish ----------- Text -- ---------Custom Format"mmm-yy" ---------
310-Jan-251-Mar-25Jan-25Feb-25Mar-25Jan-25Feb-25Mar-25
431-Mar-251-Apr-25Mar-25Apr-25Mar-25Apr-25
531-Mar-251-May-25Mar-25Apr-25May-25Mar-25Apr-25May-25
61-Jan-2531-Mar-25Jan-25Feb-25Mar-25Jan-25Feb-25Mar-25
7c
Cell Formulas
RangeFormula
E3:G3,E5:G6,E4:F4E3=TEXT(EDATE(B3-DAY(B3)+1,SEQUENCE(,MONTH(C3)-MONTH(B3)+1)-1),"mmm-yy")
H3:J3,H5:J6,H4:I4H3=EDATE(B3-DAY(B3)+1,SEQUENCE(,MONTH(C3)-MONTH(B3)+1)-1)
Dynamic array formulas.
 
Upvote 0

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