How many times each month appears between dates

jebenexcel

Board Regular
Joined
Mar 16, 2018
Messages
59
Hello;

I need a function (or 12) that tells me for each month how many times it appears between two dates.

So let's say I have the dates 1.1.2019 and 31.7.2020.

The output should be:

January 2
February 2
March 2
April 2
May 2
June: 2
July: 2
August: 1
September: 1
October: 1
November : 1
December: 1

It should work for cases where the two dates span less than one year, one year exactly, or more than one year.

As of now, my function works more or less, but if the dates are less than a year apart and there is a change of year in between ( say 1.8.2019-28.2.2020) it doesn't work.

The output in this case should be:

January 1
February 1
March 0
April 0
May 0
June: 0
July: 0
August: 1
September: 1
October: 1
November : 1
December: 1

Has anyone encountered this problem before and has a solution?

Thanks!
 
Last edited:

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type

Forum statistics

Threads
1,223,099
Messages
6,170,107
Members
452,302
Latest member
TaMere

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