Calc Finish Date from known Start Date and Duration across 2 shifts on different Workdays

PGC14

New Member
Joined
Apr 26, 2022
Messages
1
Office Version
  1. 365
Platform
  1. Windows
I am building a Planning Model for a manufacturing company and need to calculate the Finish Date and Time from a known Start Date, Time and Job Duration. The complicating thing here is that they have 2 shifts - Dayshift work Monday to Friday, and Nightshift Monday to Thursday. Although Friday is not a workday for Nightshift the formula needs to use the dayshift hours for the Friday (in addition to the hours Monday to Thursday) to calculate the correct Finish Date and Time.

I am using the NETWORKDAY.INTL formula and specifying the working days in the array. I have used "000011" for Dayshift and "0000111" for Nightshift.

I have only been able to use one or the other in my development of the formula but when using the Nightshift specified days, it assumes there is no work on the Friday which is incorrect as Dayshift work all of Friday.

MY attached worksheet shows various examples and the results in column E. Note that in E6 I have changed the specified working days in the array to reflect the 4 working days for Nightshift, but when I do this it shifts the Finish date to the 4th. If I leave the array as per dayshift, it assumes Nightshift work on the Friday Night which is incorrect.

Planning Model April 2022.xlsm
ABCDEFGHIJKLMN
1
2PackingStartDatePacking Start TimeStartDateandTimePacking Duration (Hours)Calculated Order Finish Date/TimeThis is what it should returnNETWORKDAYS.INTL specified working days array
331/03/20227:0031/03/2022 07:002.0031/03/2022 9:0031/03/2022 9:00Duration consumed only Dayshift Hours"0000011"Working Days Monday to Friday
431/03/20227:0031/03/2022 07:0011.0031/03/2022 18:0031/03/2022 18:00Duration consumed all Dayshift Hours and some of Nightshift Hours"0000011"Working Days Monday to Friday
531/03/20227:0031/03/2022 07:0020.001/04/2022 9:001/04/2022 9:00Duration consumed all Dayshift Hours, all Nightshift Hours, and some of next days Dayshift"0000011"Working Days Monday to Friday
631/03/20227:0031/03/2022 07:0020.004/04/2022 9:001/04/2022 9:00Duration consumed all Dayshift Hours, all Nightshift Hours but assumed no Dayhsift on Friday so only looked at Monday's Dayhsift hours"0000111"Working Days Monday to THURSDAY
7
8
9It returns this which is incorrect as whilst the Friday is not a Working Day for Nighshift but it is for Dayshift. I want it to consider the Dayshift hours on a Friday to arrive at the correct Order Finish Date and Time
10
11
12Statutory + Company Non-Working Days2022Shift Start and Finish Times
13DayDateStart_Hour_Day7:00:00 AM
14Monday3-Jan-22Finish_Hour_Day3:30:00 PM
15Tuesday4-Jan-22Start_Hour_Night3:30:00 PM
16Wednesday5-Jan-22Finish_Hour_Night1:00:00 AM
17Thursday6-Jan-22
18Friday7-Jan-22
19Monday31-Jan-22
20Monday7-Feb-22
21Friday15-Apr-22
22Monday18-Apr-22
23Monday25-Apr-22
24Monday6-Jun-22
25Friday24-Jun-22
26Monday24-Oct-22
27Friday23-Dec-22
28Monday26-Dec-22
29Tuesday27-Dec-22
30Wednesday28-Dec-22
31Thursday29-Dec-22
32Friday30-Dec-22
33
34
35
36
37
38
Packing
Cell Formulas
RangeFormula
C3:C6C3=A3+B3
E3:E4E3=(WORKDAY.INTL(C3,CEILING((D3/24+MOD(C3,1)-Start_Hour_Day)/(MOD(Finish_Hour_Night-Start_Hour_Day,1)),1)-1,"0000011",NoWorking))+MOD(C3,1)+D3/24-CEILING((MOD(C3,1)+D3/24-Start_Hour_Day),MOD(Finish_Hour_Night-Start_Hour_Day,1))+MOD(Finish_Hour_Night-Start_Hour_Day,1)
E5E5=(WORKDAY.INTL(C5,CEILING((D5/24+MOD(C5,1)-Start_Hour_Day)/(MOD(Finish_Hour_Night-Start_Hour_Day,1)),1)-1,"0000011",No_Working))+MOD(C5,1)+D5/24-CEILING((MOD(C5,1)+D5/24-Start_Hour_Day),MOD(Finish_Hour_Night-Start_Hour_Day,1))+MOD(Finish_Hour_Night-Start_Hour_Day,1)
E6E6=(WORKDAY.INTL(C6,CEILING((D6/24+MOD(C6,1)-Start_Hour_Day)/(MOD(Finish_Hour_Night-Start_Hour_Day,1)),1)-1,"0000111",No_Working))+MOD(C6,1)+D6/24-CEILING((MOD(C6,1)+D6/24-Start_Hour_Day),MOD(Finish_Hour_Night-Start_Hour_Day,1))+MOD(Finish_Hour_Night-Start_Hour_Day,1)
A14:A32A14=TEXT(B14,"dddd")
Named Ranges
NameRefers ToCells
Finish_Hour_Night=Packing!$E$16E3:E6
No_Working=Packing!$B$14:$B$38E5:E6, A14
Start_Hour_Day=Packing!$E$13E3:E6
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.

Forum statistics

Threads
1,223,886
Messages
6,175,191
Members
452,616
Latest member
intern444

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