Time difference in Months, but represented for each Year separately

tomekm

New Member
Joined
Mar 31, 2017
Messages
9
Given a start date and end date, I'm trying to calculate the time diff. in number of Months, BUT representing the count of the Months per each year. For example:

Start Date: 01/25/2020
End Date: 06/28/2023


Occurrences in 2020 only: formula I have: timediff (in months) between Start Date and 12/31/2020
Occurrences in 2021 only: need formula here (I cannot hard code the value of 12)
Occurrences in 2022 only: need formula here (I cannot hard code the value of 12)
Occurrences in 2023 only: formula I have: timediff (in months) between 01/01/2023 and End Date

Thank you!
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
@tomekm Not sure of your existing formula and whether it rounds or whatever but maybe like below to capture the 'inbetween' 12's ?

Bridal Stuff2.xlsx
AB
1Start25/01/2020
2End28/06/2023
3
42020Your Existing formula?
5202112
6202212
72023Your Existing formula?
Sheet7
Cell Formulas
RangeFormula
B4:B7B4=IF(AND(YEAR(B$1)<A4,YEAR(B$2)>A4),12,"Your Existing formula?")


Hope that helps.
 
Upvote 0
If you have 365, this would be nice.
MrExcelPlayground4.xlsx
ABCDE
1Yearmonths
2Start1/25/2020202012
3End6/28/2023202112
4202212
520236
Sheet4
Cell Formulas
RangeFormula
D2:D5D2=SEQUENCE((YEAR(B3)-YEAR(B2)+1))+YEAR(B2)-1
E2:E5E2=SUM((--(DATE(D2,SEQUENCE(12),1)>=DATE(YEAR($B$2),MONTH($B$2),1))*(--(DATE(D2,SEQUENCE(12),1)<=DATE(YEAR($B$3),MONTH($B$3),DAY($B$3))))))
Dynamic array formulas.


I think there are work arounds for older excel.
 
Upvote 0

Forum statistics

Threads
1,214,430
Messages
6,119,453
Members
448,898
Latest member
drewmorgan128

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