Need a formula for 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

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
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

Forum statistics

Threads
1,215,491
Messages
6,125,108
Members
449,205
Latest member
ralemanygarcia

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