Formula to Determine How Many Days From a Specified Date Range Appear in a Different Date Range?

Gadgetgav

New Member
Joined
Aug 26, 2009
Messages
37
Hi All,

I have a list of events with start date and end dates (sometimes these are single day events) but I need to know how many working days appear in a certain month.

For example someone has taken a holiday from the 29th of January to the 5th of February 2021 this is 6 working days but only 5 of those are in February.

Is there a formula I can apply that will take the start date and end date of the event then calculate how many working days in that range are from each month (so in the above example it would give me 1 for Jan, 5 for Feb, 0 for Mar etc.)?

Thanks in advance (please ask if my question doesn't make sense)
Gav
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
Do you have 365? This takes EOMONTH. If not, you can replace eomonth with a somewhat more convoluted formula.

MrExcelPlayground.xlsm
ABCDEFGHIJKLMN
1StartEnd1/1/20212/1/20213/1/20214/1/20215/1/20216/1/20217/1/20218/1/20219/1/202110/1/202111/1/202112/1/2021
21/5/20211/10/2021400000000000
31/8/20211/8/2021100000000000
41/29/20212/4/2021140000000000
52/24/20216/3/2021032322213000000
Sheet45
Cell Formulas
RangeFormula
D1:N1D1=EOMONTH(C1,0)+1
C2:N5C2=MAX(0,NETWORKDAYS(MAX(C$1,$A2),MIN($B2,EOMONTH(C$1,0))))


For older versions of excel:
MrExcelPlayground.xlsm
ABCDEFGHIJKLMN
7StartEnd1/1/20212/1/20213/1/20214/1/20215/1/20216/1/20217/1/20218/1/20219/1/202110/1/202111/1/202112/1/2021
81/5/20211/10/2021400000000000
91/8/20211/8/2021100000000000
101/29/20212/4/2021140000000000
112/24/20216/3/2021032322213000000
Sheet45
Cell Formulas
RangeFormula
C8:N11C8=MAX(0,NETWORKDAYS(MAX(C$1,$A8),MIN($B8,(DATE(YEAR((DATE(YEAR(C$7),MONTH(C$7),1)+32)),MONTH((DATE(YEAR(C$7),MONTH(C$7),1)+32)),1)-1))))
 
Last edited:
Upvote 0
Solution

Forum statistics

Threads
1,223,239
Messages
6,170,947
Members
452,368
Latest member
jayp2104

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