Calculate # of Months in a Calendar Yr Given a Start/End Date Range

Redfly88

New Member
Joined
Jul 31, 2018
Messages
5
Hi, can someone please help me derive a formula to calculate the number of months that would fall within any given Calendar Year based on a contracts start and end date range. For instance, if I had a contract start date of 9/29/2017 and contract end date of 9/28/2020, and I know each calendar year is from Jan 1st to Dec 31st, then how could I calculate the number of months in each calendar year. I want to be able to take the pro-rated months the contract falls in each year and multiply that to get the total pro-rated revenue each calendar year.

So conceptually like this: (Total months contract exists in a Calendar Year/Total months for the entire contract) X Total Contract Revenue.

INPUT: Given Contract:

StartEndTotal ValueTotal Months
9/27/20179/28/2020$39,60036.03

<tbody>
</tbody>

INPUT: Calendar Years:
YearStartEnd
20161/1/201612/31/2016
20171/1/201712/31/2017
20181/1/201812/31/2018
20191/1/201912/31/2019
2020
1/1/202012/31/2020
20211/1/202112/31/2021

<tbody>
</tbody>


DESIRED OUTPUT: Calculation to Allocate Months in Contract for prorating revenue:
Year2017201820192020Total
Months3.0912.0012.008.9436.03
Revenue$3,396$13,188$13,188$9,828$39,600

<tbody>
</tbody>

I have been struggling to figure out a straight-way method of doing this in a single cell.
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
I found it expedient to use days instead of months; it's hard to rationalise what 36.03 months means because the twelve months have different days and there are leap years.

I hope this helps. I included dates outside the range within the contract to tests the formulas.

Copy B6 across and down.

[FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif]
Book1
ABCDEFGH
1StartEndTotal ValueTotal Days
29/27/179/28/20$39,6001098
3
4
5Year201620172018201920202021Total
6Days0.0096.00365.00365.00272.000.001098
7Revenue0.003,462.3013,163.9313,163.939,809.840.0039,600.00
Sheet41
Cell Formulas
RangeFormula
D2=B2-A2+1
B6=IF((B5>=YEAR($A$2))*(B5<=YEAR($B$2)),DATE(B5,12,31)-MAX(DATE(B5,1,1),$A$2)+1,0)
H6=SUM(B6:G6)
H7=SUM(B7:G7)
[/FONT]
 
Upvote 0
Thanks, that is better than what I had which was nothing. But for some reason, I am not getting the same amount total days you do as I get 1096 days using the same formula.

Also, my Days for the Calendar years differ even though I use the same formula. I get 94, 365, 365, 366 days respectively for Calendar Years 2017, 2018, 2019, 2020. For some reason 2020 is giving me 366 days. Not sure what I am doing wrong.

I am not sure why since it seems to be working the other Calendar Years. Formula makes sense as you're saying if the Calendar Year falls in between the contract start and end date then take the last day of that specific Calendar Year and subtract the maximum of the two number either the first of the Calendar Year or the contract date).
 
Upvote 0
Here are the values I am getting. For some reason, the last year 2020 keeps showing 366 days even though the other years are correct instead of 272 days.

FGHIJ
12017201820192020Total
2963653653661192
3$3,462.30$13,163.93$13,163.93$13,200.00

<tbody>
</tbody>
 
Upvote 0

Forum statistics

Threads
1,221,310
Messages
6,159,173
Members
451,543
Latest member
cesymcox

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