Elapsed time accounting for shift hours and weekends

ChiefsFan1967

New Member
Joined
Mar 12, 2020
Messages
2
Platform
  1. Windows
I'm trying to come up with a formula that will show total time a job is in a department, taking into account a shift working from 7:00 am to 3:30 pm, and discounting weekends. Start/End times are entered as 3/12/20 9:00 AM, result of formula should be hh:mm. I know this involves the networkdays function, but am not knowledgeable enough to come up with the actual formula. This is just part of a larger spreadsheet I have to keep, so I will actually be using this formula for numerous other calculations involving similar Start/End/Totals. I appreciate any help, and apologize in advance for any needed information or specifics I have omitted.

Example: ( column D is just used to indicate dates involving a weekend, not part of calculation)
2020-03-12 10_55_20-Book3 - Excel.png
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Hey, these questions are always tricky with so much criteria going on but try this in cell C2 and drag down the C column:

=IF((A2-ROUNDDOWN(A2,0))<(7/24),8.5,IF((A2-ROUNDDOWN(A2,0))>(15.5/24),0,((15.5/24)-(A2-ROUNDDOWN(A2,0)))*24))+IF(B2-ROUNDDOWN(B2,0)<(7/24),0,IF(B2-ROUNDDOWN(B2,0)>(15.5/24),8.5,(B2-ROUNDDOWN(B2,0)-(7/24))*24))+(NETWORKDAYS(A2,B2)-2)*8.5
 
Upvote 0
Hey, these questions are always tricky with so much criteria going on but try this in cell C2 and drag down the C column:

=IF((A2-ROUNDDOWN(A2,0))<(7/24),8.5,IF((A2-ROUNDDOWN(A2,0))>(15.5/24),0,((15.5/24)-(A2-ROUNDDOWN(A2,0)))*24))+IF(B2-ROUNDDOWN(B2,0)<(7/24),0,IF(B2-ROUNDDOWN(B2,0)>(15.5/24),8.5,(B2-ROUNDDOWN(B2,0)-(7/24))*24))+(NETWORKDAYS(A2,B2)-2)*8.5
testing now, I think this will work. will let you know for sure in a little bit.
 
Upvote 0

Forum statistics

Threads
1,214,979
Messages
6,122,551
Members
449,088
Latest member
davidcom

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