Count number of days within certain month within a date range

Marmasek

New Member
Joined
Nov 20, 2019
Messages
8
I am looking for assistance to create a formula that counts the number of days within a certain month within a date range. The numbers found in C2, D2, E2 and F2 are where I would like to input a formula to auto populate after entering the start and end dates.

For example:
Start DateEnd DateJanFebMarApr
30 Jan 20205 Apr 2020229305
 
Following on from the post above, I have a similar scenario that I would be grateful for some assistance with. Instead of counting total days each month, I need to calculate business days each month I.e. Monday to Friday and if possible excluding bank holidays.
 
Upvote 0

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Hi,

Do you mean this?

Book3.xlsx
ABCD
1StartEndTotal Workdays
21/3/20213/31/202163
Sheet884
Cell Formulas
RangeFormula
D2D2=NETWORKDAYS(A2,B2)


Go here to learn how to set up your Holiday list:

 
Upvote 0
... I have a similar scenario... Instead of counting total days each month, I need to calculate business days each month I.e. Monday to Friday and if possible excluding bank holidays.
See if the following formula works for you:
Excel Formula:
=MAX(0,NETWORKDAYS(MAX($A2,C$1),MIN($B2,EOMONTH(C$1,0)),Holidays))
where Holidays is a named range containing bank holiday dates.
 
Upvote 0
I'll assume the 4 May 2020 entry should show 28 days remaining in May.

I need the year of the heading month so it doesn't count 2019 or 2021 dates so I've entered the actual 1st of the month for each column and just formatted it a mmm-yy.

View attachment 342

Book1
ABCDEFGHIJKLMN
1Start dateEnd date1/1/20202/1/20203/1/20204/1/20205/1/20206/1/20207/1/20208/1/20209/1/202010/1/202011/1/202012/1/2020
21/30/20204/5/202022931500000000
35/4/20206/3/20200000283000000
Sheet1
Cell Formulas
RangeFormula
D1:N1D1=EOMONTH(C1,0)+1
C2:N3C2=IF(EOMONTH($A2,0)=EOMONTH(C$1,0),EOMONTH($A2,0)-$A2+1,IF(EOMONTH($B2,0)=EOMONTH(C$1,0),$B2-EOMONTH($B2,-1),IF(AND(C$1>$A2,C$1<$B2),EOMONTH(C$1,0)-EOMONTH(C$1,-1),0)))
I noticed an error in this formula in instances when the start date and end date are on the same month, currently working on a fix, but otherwise very useful!
 
Upvote 0
I noticed an error in this formula in instances when the start date and end date are on the same month, currently working on a fix, but otherwise very useful!
New Modified formula, seems to be working thus far, added a new IF function in the beginning

=IF(AND(EOMONTH($A2,0)=EOMONTH(C$1,0),EOMONTH($B2,0)=EOMONTH(C$1,0)),$B2-$A2+1,
IF(EOMONTH($A2,0)=EOMONTH(C$1,0),EOMONTH($A2,0)-$A2+1,IF(EOMONTH($B2,0)=EOMONTH(C$1,0),$B2-EOMONTH($B2,-1),IF(AND(C$1>$A2,C$1<$B2),EOMONTH(C$1,0)-EOMONTH(C$1,-1),0))))
 
Upvote 0

Forum statistics

Threads
1,223,655
Messages
6,173,610
Members
452,522
Latest member
saeedfiroozei

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