Formula help needed for working with days and times.

dshtesy

New Member
Joined
Jun 22, 2023
Messages
8
Office Version
  1. 365
Platform
  1. Windows
Please see below table.

I am trying to get a formula for column D which works out the time taken from generated to started, taking into account working time and working days. I also have a list of bank holidays to be ignored on a separate sheet.

Once I get that, I can do further formulas for time taken for Start to Completed and Generated to Completed.

Currently in D3 is the following formula which works fine for most but, struggles once there is an entry where the start time falls outside of the work hours, for instance rows 5 and row 8.

For times that are before 7:00, the generated time should be 7:00 for the day, or next working day if the day is not a working day. For times after 17:00, the generated time should be 7:00 for the next working day.

Please can someone help?


Thanks

=IF(B3="","Not Started",IF(AND(NETWORKDAYS(A3,B3,'Bank Holidays'!$A$1:$A$8)>0, A3<>""),(NETWORKDAYS(A3,B3,'Bank Holidays'!$A$1:$A$8)-1)*($D$1-$B$1)+MOD(B3,1) - IF(OR(MOD(A3,1)<$B$1, MOD(A3,1)>$D$1), $B$1, MOD(A3,1)) + IF(MOD(A3,1)<$B$1, $B$1-MOD(A3,1), 0) + IF(MOD(B3,1)>$D$1, MOD(B3,1)-$D$1, 0),0))



Row/ColumnABCD
1Work Start Time:
07:00:00​
Work End Time:
17:00:00​
2GeneratedStartedCompletedLogged to Start
3
03/06/2024 10:29​
03/06/2024 11:56​
03/06/2024 12:10​
01:27:31​
4
03/06/2024 13:21​
03/06/2024 14:38​
04/06/2024 08:09​
01:17:26​
5
04/06/2024 06:53​
04/06/2024 08:23​
04/06/2024 08:23​
01:30:04​
6
04/06/2024 07:54​
04/06/2024 08:39​
04/06/2024 08:39​
00:45:39​
7
04/06/2024 08:14​
04/06/2024 08:22​
04/06/2024 08:22​
00:08:16​
8
04/06/2024 20:09​
06/06/2024 12:10​
10/06/2024 07:23​
01:10:34​
9
05/06/2024 07:38​
06/06/2024 12:10​
06/06/2024 12:19​
14:31:47​
10
05/06/2024 08:47​
06/06/2024 12:10​
07/06/2024 06:55​
13:23:35​
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.

Forum statistics

Threads
1,224,795
Messages
6,180,993
Members
453,011
Latest member
Osamu9Dazai

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