Calculating exact fraction of months during period
17:14 30 Sep 2015

I have a list of periods (given by period start, period end) in Excel and I have to calculate exactly how many months (as a fraction) are during that period.

E.g. if given a period January 15th to March 7th, then this would be

15-01-2015 until 31-01-2015 = 17 days
01-02-2015 until 28-02-2015 = 28 days
01-03-2015 until 07-03-2015 =  7 days

Months during period = 17/31 + 28/28 + 7/31 = 1,774193548 months

Note that in this calculation, start date and end date are both counted as part of the period.

As the periods can be anything, then I haven't been able to figure out to calculate this with an Excel formula (or if it's even possible).

Any ideas?

excel date datetime excel-formula