Business Hours Mon-Fri 8AM - 5PM between two dates and times

catterz66

New Member
Joined
Apr 26, 2024
Messages
2
Office Version
  1. 2021
Platform
  1. Windows
I desperately need a formula ASAP for calculating the working hours of 8AM - 5PM between a start date and end date, that doesn't count any hours outside of this range (which means no weekend hours).

For example if I had these two dates 12/04/24 10:50AM and 15/04/24 2:15PM, I would want to see only the hours that are in between that range. I know how to calculate the total hours between the two, but I can't restrict it down to not exclude hours outside a specific date and time range.

Please if anyone can help, need this formula within the next two days !
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
how about
=(NETWORKDAYS(B5,C5)-1)*($G$3-$G$2)
+IF(NETWORKDAYS(C5,C5),MEDIAN(MOD(C5,1),$G$3,$G$2),$G$3)
-MEDIAN(NETWORKDAYS(B5,B5)*MOD(B5,1),$G$3,$G$2)

where
G2 is the lower time 08:00
and G3 is the upper time 17:00

Book13
ABCDEFGH
1
28:00
317:00
4
51/6/24 5:001/8/24 10:002:00:00SatMon
64/12/24 10:504/15/24 14:1512:25:00FriMon
7
8
96:106:15
Sheet1
Cell Formulas
RangeFormula
G5:H5,G6G5=B5
H6H6=C5
E5:E6E5=(NETWORKDAYS(B5,C5)-1)*($G$3-$G$2) +IF(NETWORKDAYS(C5,C5),MEDIAN(MOD(C5,1),$G$3,$G$2),$G$3) -MEDIAN(NETWORKDAYS(B5,B5)*MOD(B5,1),$G$3,$G$2)


If we take your example
12/04/24 10:50AM and 15/04/24 2:15PM,
thats 6hrs 10min on the friday
and 6hrs 15 min on the monday
total = 12hr 25 min

format the results cell in [H]:MM to show hours above 24

formula from
 
Last edited:
Upvote 0
That worked perfectly when i added the 0800 and 1700 as their own values in g2 and g3 ! thankyou
 
Upvote 0
Hello all, I hope this is allowed.

I have today located the above formula which I have made great use of, however, I need to adapt the formula to include ALL days and not just NETWORKDAYS (which I believe is just Mon-Fri).

Can anyone help?

Thanks in advance
 
Upvote 0
Hi, Can someone please help me calculate the hours between 2 dates, excluding non-business hours only?

Business hours: 9:00 AM to 1:00 AM (next day)

Example:
Created time: 2024-08-03 00:14:50
Initial response time: 2024-08-03 03:02:46

Any help is greatly appreciated!

GH
 
Upvote 0

Forum statistics

Threads
1,224,809
Messages
6,181,076
Members
453,020
Latest member
mattg2448

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