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:
[TABLE="width: 500"]
<tbody>[TR]
[TD="align: center"]Start[/TD]
[TD="align: center"]End[/TD]
[TD="align: center"]Total Value[/TD]
[TD="align: center"]Total Months[/TD]
[/TR]
[TR]
[TD="align: center"]9/27/2017[/TD]
[TD="align: center"]9/28/2020[/TD]
[TD="align: center"]$39,600[/TD]
[TD="align: center"]36.03[/TD]
[/TR]
</tbody>[/TABLE]
INPUT: Calendar Years:
[TABLE="width: 300"]
<tbody>[TR]
[TD="align: center"]Year[/TD]
[TD="align: center"]Start[/TD]
[TD="align: center"]End[/TD]
[/TR]
[TR]
[TD="align: center"]2016[/TD]
[TD="align: center"]1/1/2016[/TD]
[TD="align: center"]12/31/2016[/TD]
[/TR]
[TR]
[TD="align: center"]2017[/TD]
[TD="align: center"]1/1/2017[/TD]
[TD="align: center"]12/31/2017[/TD]
[/TR]
[TR]
[TD="align: center"]2018[/TD]
[TD="align: center"]1/1/2018[/TD]
[TD="align: center"]12/31/2018[/TD]
[/TR]
[TR]
[TD="align: center"]2019[/TD]
[TD="align: center"]1/1/2019[/TD]
[TD="align: center"]12/31/2019
[/TD]
[/TR]
[TR]
[TD="align: center"]2020
[/TD]
[TD="align: center"]1/1/2020[/TD]
[TD="align: center"]12/31/2020[/TD]
[/TR]
[TR]
[TD="align: center"]2021[/TD]
[TD="align: center"]1/1/2021[/TD]
[TD="align: center"]12/31/2021[/TD]
[/TR]
</tbody>[/TABLE]
DESIRED OUTPUT: Calculation to Allocate Months in Contract for prorating revenue:
[TABLE="width: 300"]
<tbody>[TR]
[TD="align: center"]Year[/TD]
[TD="align: center"]2017[/TD]
[TD="align: center"]2018[/TD]
[TD="align: center"]2019[/TD]
[TD="align: center"]2020[/TD]
[TD="align: center"]Total[/TD]
[/TR]
[TR]
[TD="align: center"]Months[/TD]
[TD="align: center"]3.09[/TD]
[TD="align: center"]12.00[/TD]
[TD="align: center"]12.00[/TD]
[TD="align: center"]8.94[/TD]
[TD="align: center"]36.03[/TD]
[/TR]
[TR]
[TD="align: center"]Revenue[/TD]
[TD="align: center"]$3,396[/TD]
[TD="align: center"]$13,188[/TD]
[TD="align: center"]$13,188[/TD]
[TD="align: center"]$9,828[/TD]
[TD]$39,600[/TD]
[/TR]
</tbody>[/TABLE]
I have been struggling to figure out a straight-way method of doing this in a single cell.
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:
[TABLE="width: 500"]
<tbody>[TR]
[TD="align: center"]Start[/TD]
[TD="align: center"]End[/TD]
[TD="align: center"]Total Value[/TD]
[TD="align: center"]Total Months[/TD]
[/TR]
[TR]
[TD="align: center"]9/27/2017[/TD]
[TD="align: center"]9/28/2020[/TD]
[TD="align: center"]$39,600[/TD]
[TD="align: center"]36.03[/TD]
[/TR]
</tbody>[/TABLE]
INPUT: Calendar Years:
[TABLE="width: 300"]
<tbody>[TR]
[TD="align: center"]Year[/TD]
[TD="align: center"]Start[/TD]
[TD="align: center"]End[/TD]
[/TR]
[TR]
[TD="align: center"]2016[/TD]
[TD="align: center"]1/1/2016[/TD]
[TD="align: center"]12/31/2016[/TD]
[/TR]
[TR]
[TD="align: center"]2017[/TD]
[TD="align: center"]1/1/2017[/TD]
[TD="align: center"]12/31/2017[/TD]
[/TR]
[TR]
[TD="align: center"]2018[/TD]
[TD="align: center"]1/1/2018[/TD]
[TD="align: center"]12/31/2018[/TD]
[/TR]
[TR]
[TD="align: center"]2019[/TD]
[TD="align: center"]1/1/2019[/TD]
[TD="align: center"]12/31/2019
[/TD]
[/TR]
[TR]
[TD="align: center"]2020
[/TD]
[TD="align: center"]1/1/2020[/TD]
[TD="align: center"]12/31/2020[/TD]
[/TR]
[TR]
[TD="align: center"]2021[/TD]
[TD="align: center"]1/1/2021[/TD]
[TD="align: center"]12/31/2021[/TD]
[/TR]
</tbody>[/TABLE]
DESIRED OUTPUT: Calculation to Allocate Months in Contract for prorating revenue:
[TABLE="width: 300"]
<tbody>[TR]
[TD="align: center"]Year[/TD]
[TD="align: center"]2017[/TD]
[TD="align: center"]2018[/TD]
[TD="align: center"]2019[/TD]
[TD="align: center"]2020[/TD]
[TD="align: center"]Total[/TD]
[/TR]
[TR]
[TD="align: center"]Months[/TD]
[TD="align: center"]3.09[/TD]
[TD="align: center"]12.00[/TD]
[TD="align: center"]12.00[/TD]
[TD="align: center"]8.94[/TD]
[TD="align: center"]36.03[/TD]
[/TR]
[TR]
[TD="align: center"]Revenue[/TD]
[TD="align: center"]$3,396[/TD]
[TD="align: center"]$13,188[/TD]
[TD="align: center"]$13,188[/TD]
[TD="align: center"]$9,828[/TD]
[TD]$39,600[/TD]
[/TR]
</tbody>[/TABLE]
I have been struggling to figure out a straight-way method of doing this in a single cell.