Count number of months per year between two dates

BenB0425

New Member
Joined
Sep 17, 2019
Messages
6
I was looking for some help with a formula. I want to count the number of months between two dates and have them be separated by the year. I received a formula but all it did was count the months and put them in the last year column. The formula that I am using is below. It works in my test sample when I type in the dates but not when I pull them from our data source.

=IFERROR(DATEDIF(MAX($F2,DATE(K$1-1,12,31)),MIN($G2,DATE(K$1,12,31)),"m")+1,0)


Column F Column H Column I
(End Date) (Begin Date) (Number of months Counted) 2011 2012 2013 2014 2015 2016

3/1/201909/1/201870000000010
3/1/201908/1/201880000000010
3/1/201908/1/201880000000010
3/1/201907/1/201890000000010
3/1/201906/1/2018100000000010
3/1/201904/1/2018120000000010
3/1/201902/1/2018140000000010
3/1/201906/1/2016340000000010
3/1/201911/1/201850000000010
3/1/201911/1/201850000000010

<colgroup><col><col><col><col><col><col span="9"></colgroup><tbody>
</tbody>


So I need a formula that with count the number of months in years 2011 - 2019. Hopefully the formula will state zeros for the years with no months and the years that the dates have months just compute those months. But as you can see the 2019 column has a higher number then it should be and the other years are not calculating.

Does that make sense? Is there any help out there
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.

Forum statistics

Threads
1,214,520
Messages
6,120,013
Members
448,935
Latest member
ijat

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