# Count days per month within interval

#### jg33

##### New Member
Hello!

I'm wondering how I count numbers of days per month month within a dateinterval?

Here is an exempel of how I want it.

A B C D E F

1. Start date End date Jan Feb Mar Apr

2. 01-15-2019 04-08-2019 17 28 31 8

I have the start date and the end date to begin with. And also in cell C1 it says 01-01-2019 and not just Jan and so on for the rest of the months.

I have tried this formula: =MAX(0,(MIN(\$A2,DATE(YEAR(C\$1),MONTH(C\$1)+1,0))-MAX(\$B2,C\$1)+1))

However, for January I get the number 31 instead of 17.

Anyone have a solution?

Thanks!

### Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.

#### Dave Patton

##### Well-known Member
T202004a.xlsm
ABCDEFGH
1StartEndTotalJan-19Feb-19Mar-19Apr-19May-19
215-Jan-1908-Apr-198417283180
3
2a
Cell Formulas
RangeFormula
C2C2=B2-A2+1
D2:H2D2=MAX(0, MIN(EOMONTH(D\$1, 0), \$B2) + 1 - MAX(D\$1, \$A2))

#### jg33

##### New Member
Hi! Thanks for trying to help! However, now instead of getting the number 31 för january it just says "jan-00".
Also, what is the purpose of calculating C2?

#### jg33

##### New Member
ah i see what i did wrong by getting jan-00. However, now it stills says 31. Just like before...

#### Dave Patton

##### Well-known Member
try copying the suggestion onto a new sheet
review the formula; you can use Excel's formula evaluate if you want
ensure you format only the dates as dates

Replies
4
Views
168
Replies
19
Views
222
Replies
1
Views
23
Replies
3
Views
303
Replies
5
Views
188

1,127,183
Messages
5,623,242
Members
415,957
Latest member
Newguy1924

### 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.

### Which adblocker are you using?

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

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