Calculate total time taken to complete task in working days (6am to 6pm)

Wibab

New Member
Joined
Jul 7, 2024
Messages
4
Office Version
  1. 365
Platform
  1. Windows
Hello,





If I have a start date/time, and an end date/time, how would I calculate how long a task is taken to complete (in days), if I only account for workdays and working shift between 6am - 6pm?





Examples below:





Data obtained 15/7/2023 20:59


Work completed 17/7/2023 15:50


So work in undertaken on 16/7 6am - 6pm (12 hours) + 17/7 6am - 3.50pm (9.83 hours).


Result should = 21 hours 50 minutes = 21.83 hours = 1.82 days





Data obtained 15/6/2024 18:13


Work completed 17/6/2024 12:16


So work is undertaken on 17/6 6am - 12.16pm (15/6 and 16/6 are on weekend).


Result should = 6 hours 16 minutes = 6.27 hours = 0.52 days.





Thank you
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
*correction: first example should return a result = 9.83 hours = 0.82 days, because 16/7/2023 is a Sunday.
 
Upvote 0
Another example:

Data obtained 15/5/2024 15:42

Work completed 17/5/2024 15:13

So work in undertaken on (15/5/24 3.42pm - 6pm) + (16/5/24 6am - 6pm) + (17/5/24 6am - 3.13pm)

Result should = 23 hours 31 minutes = 23.52 hours = 1.96 days
 
Upvote 0
I've found some ideas from an older thread and modified them to your criteria. Try:
Book1
ABC
1StartEndWorked days
27/15/23 20:597/17/23 15:500.82
36/15/24 18:136/17/24 12:160.52
45/15/24 15:425/17/24 15:131.96
Sheet2
Cell Formulas
RangeFormula
C2:C4C2=2*LET( start,A2,end,B2,upTime,18/24,lowTime,6/24, (NETWORKDAYS(start,end)-1)*(upTime-lowTime) +IF(NETWORKDAYS(end,end),MEDIAN(MOD(end,1),upTime,lowTime),upTime) -MEDIAN(NETWORKDAYS(start,start)*MOD(start,1),upTime,lowTime) )
 
Last edited:
Upvote 0
Perfect, that's exactly what I'm after.
Thank you very much for your help! 😊
 
Upvote 0

Forum statistics

Threads
1,224,808
Messages
6,181,072
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