# Time difference in Months, but represented for each Year separately

#### tomekm

##### New Member
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

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.

#### Snakehips

##### Well-known Member
@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
5202112
6202212
Sheet7
Cell Formulas
RangeFormula

Hope that helps.

#### JamesCanale

##### Active Member
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.

Replies
2
Views
173
Replies
7
Views
103
Replies
8
Views
410
Replies
5
Views
112
Replies
2
Views
63

1,147,482
Messages
5,741,406
Members
423,657
Latest member
Medrok2021

### 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.

### Which adblocker are you using?

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

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