Date and Time Formulas

Stelio

New Member
Joined
Oct 8, 2015
Messages
28
Office Version
  1. 365
Platform
  1. Windows
Hi Fellow Excel'ers,

I'm stumped on how to get the desired result with date and time formula in document provided.

I think I've put in enough info on this document to explain the issue but will try here too.

I am needing to have the formulas correctly calculate the required response and rectification date/time during business hours based on a given date to have suppliers attend jobs on time and measure their KPI's.

The issue I have is the formula is calculating the hours correctly, but it is not giving them the full business days allowance if the time the work order was issued falls outside business times.

Not sure if I've done a good job explaining but if anyone can help I'm happy to answer any questions. The spreadsheet provided should clarify hopefully.

EXPORT SHEET:

MASTER EM SLA Report w incorrect data.xlsx
ABCDEFGHIJKLMNOP
1PriorityResponse StatusRectification StatusWork Order Issued Date TimeResponse Due DateCompletion Due Date Time
2P4CompletedIn Progress2/3/2023 2:10:47 PM2/20/2023 2:10:47 PM2/23/2023 2:10:47 PM
3P4CompletedIn Progress2/3/2023 2:11:20 PM2/20/2023 2:11:20 PM2/23/2023 2:11:20 PM
4P3OverdueIn Progress2/7/2023 5:41:40 PM2/13/2023 9:41:40 AM2/16/2023 9:41:40 AM
5P3CompletedCompleted2/11/2023 11:40:32 AM2/15/2023 11:40:32 AM2/20/2023 11:40:32 AM
6P3CompletedCompleted2/12/2023 10:03:38 AM2/15/2023 10:03:38 AM2/20/2023 10:03:38 AM
7P3CompletedCompleted2/12/2023 11:20:18 AM2/15/2023 11:20:18 AM2/20/2023 11:20:18 AM
8P4CompletedCompleted2/18/2023 12:13:01 AM3/3/2023 12:13:01 AM3/8/2023 12:13:01 AM
9P3OverdueIn Progress2/21/2023 10:43:55 AM2/24/2023 10:43:55 AM3/1/2023 10:43:55 AM
10P4OverdueIn Progress2/23/2023 9:47:31 AM3/9/2023 9:47:31 AM3/14/2023 9:47:31 AM
11P4OverdueIn Progress2/23/2023 11:00:49 AM3/9/2023 11:00:49 AM3/14/2023 11:00:49 AMCurrent Formulas in column E and F
12P4OverdueIn Progress2/23/2023 11:02:27 AM3/9/2023 11:02:27 AM3/14/2023 11:02:27 AM
13P4OverdueIn Progress2/23/2023 3:12:49 PM3/9/2023 3:12:49 PM3/14/2023 3:12:49 PM
14P4CompletedIn Progress2/24/2023 2:08:56 PM3/10/2023 2:08:56 PM3/15/2023 2:08:56 PM
15P4OverdueIn Progress2/24/2023 3:31:34 PM3/10/2023 3:31:34 PM3/15/2023 3:31:34 PM
16P4OverdueIn Progress2/24/2023 3:46:37 PM3/10/2023 3:46:37 PM3/15/2023 3:46:37 PM
17P3CompletedCompleted2/25/2023 5:31:51 AM3/1/2023 5:31:51 AM3/6/2023 5:31:51 AM
18P3CompletedCompleted2/25/2023 7:34:53 AM3/1/2023 7:34:53 AM3/6/2023 7:34:53 AM
19P3CompletedCompleted2/26/2023 5:34:34 AM3/1/2023 5:34:34 AM3/6/2023 5:34:34 AM
20P3CompletedCompleted2/26/2023 6:51:51 AM3/1/2023 6:51:51 AM3/6/2023 6:51:51 AM
21P4In ProgressIn Progress2/27/2023 4:06:00 PM3/14/2023 8:06:00 AM3/17/2023 8:06:00 AM
22P4In ProgressIn Progress2/27/2023 4:30:41 PM3/14/2023 8:30:41 AM3/17/2023 8:30:41 AM
23P4In ProgressIn Progress2/27/2023 4:48:00 PM3/14/2023 8:48:00 AM3/17/2023 8:48:00 AM
24P4In ProgressIn Progress2/28/2023 2:40:33 PM3/14/2023 2:40:33 PM3/17/2023 2:40:33 PM
25P4In ProgressIn Progress2/28/2023 6:30:47 PM3/15/2023 10:30:47 AM3/20/2023 10:30:47 AM
26P4In ProgressIn Progress2/28/2023 6:37:14 PM3/15/2023 10:37:14 AM3/20/2023 10:37:14 AM
27P3CompletedIn Progress2/28/2023 7:58:59 PM3/6/2023 11:58:59 AM3/9/2023 11:58:59 AM
28
29For P3 (Column A)
30Column E needs to be 3 full business days after Column D if Column D lands on a public holiday or weekend (business day starts at 8am and ends 4pm) OR 24 business hours from date/time of Column F if Column D is during business hours.
31Column F needs to be 6 full business days after Column D if Column D lands on a public holiday or weekend (business day starts at 8am and ends 4pm) OR 48 business hours from date/time of Column F if Column D is during business hours.
32
33For P4 (Column A)
34Column E needs to be 10 full business days after Column D if Column D lands on a public holiday or weekend (business day starts at 8am and ends 4pm) OR 80 business hours from date/time of Column F if Column D is during business hours.
35Column F needs to be 13 full business days after Column D if Column D lands on a public holiday or weekend (business day starts at 8am and ends 4pm) OR 104 business hours from date/time of Column F if Column D is during business hours.
36
37Desired Results of above table as below.
38
39PriorityResponse StatusRectification StatusWork Order Issued Date TimeResponse Due DateCompletion Due Date Time
40P4CompletedIn Progress2/3/2023 2:10:47 PM2/17/2023 2:10:47 PM2/22/2023 2:10:47 PM
41P4CompletedIn Progress2/3/2023 2:11:20 PM2/17/2023 2:11:20 PM2/22/2023 2:11:20 PM
42P3OverdueIn Progress2/7/2023 5:41:40 PM2/10/2023 4:00:00 PM2/15/2023 4:00:00 PM
43P3CompletedCompleted2/11/2023 11:40:32 AM2/15/2023 4:00:00 PM2/20/2023 4:00:00 PM
44P3CompletedCompleted2/12/2023 10:03:38 AM2/15/2023 4:00:00 PM2/20/2023 4:00:00 PM
45P3CompletedCompleted2/12/2023 11:20:18 AM2/15/2023 4:00:00 PM2/20/2023 4:00:00 PM
46P4CompletedCompleted2/18/2023 12:13:01 AM3/3/2023 4:00:00 PM3/8/2023 4:00:00 PM
47P3OverdueIn Progress2/21/2023 10:43:55 AM2/24/2023 10:43:55 AM3/1/2023 10:43:55 AM
48P4OverdueIn Progress2/23/2023 9:47:31 AM3/9/2023 9:47:31 AM3/14/2023 9:47:31 AM
49P4OverdueIn Progress2/23/2023 11:00:49 AM3/9/2023 11:00:49 AM3/14/2023 11:00:49 AM
50P4OverdueIn Progress2/23/2023 11:02:27 AM3/9/2023 11:02:27 AM3/14/2023 11:02:27 AM
51P4OverdueIn Progress2/23/2023 3:12:49 PM3/9/2023 3:12:49 PM3/14/2023 3:12:49 PM
52P4CompletedIn Progress2/24/2023 2:08:56 PM3/10/2023 2:08:56 PM3/15/2023 2:08:56 PM
53P4OverdueIn Progress2/24/2023 3:31:34 PM3/10/2023 3:31:34 PM3/15/2023 3:31:34 PM
54P4OverdueIn Progress2/24/2023 3:46:37 PM3/10/2023 3:46:37 PM3/15/2023 3:46:37 PM
55P3CompletedCompleted2/25/2023 5:31:51 AM3/1/2023 4:00:00 PM3/6/2023 4:00:00 PM
56P3CompletedCompleted2/25/2023 7:34:53 AM3/1/2023 4:00:00 PM3/6/2023 4:00:00 PM
57P3CompletedCompleted2/26/2023 5:34:34 AM3/1/2023 4:00:00 PM3/6/2023 4:00:00 PM
58P3CompletedCompleted2/26/2023 6:51:51 AM3/1/2023 4:00:00 PM3/6/2023 4:00:00 PM
59P4In ProgressIn Progress2/27/2023 4:06:00 PM3/13/2023 4:00:00 PM3/16/2023 4:00:00 PM
60P4In ProgressIn Progress2/27/2023 4:30:41 PM3/13/2023 4:00:00 PM3/16/2023 4:00:00 PM
61P4In ProgressIn Progress2/27/2023 4:48:00 PM3/13/2023 4:00:00 PM3/16/2023 4:00:00 PM
62P4In ProgressIn Progress2/28/2023 2:40:33 PM3/14/2023 2:40:33 PM3/17/2023 2:40:33 PM
63P4In ProgressIn Progress2/28/2023 6:30:47 PM3/14/2023 4:00:00 PM3/17/2023 4:00:00 PM
64P4In ProgressIn Progress2/28/2023 6:37:14 PM3/14/2023 4:00:00 PM3/17/2023 4:00:00 PM
65P3CompletedIn Progress2/28/2023 7:58:59 PM3/3/2023 4:00:00 PM3/8/2023 4:00:00 PM
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
Export
Cell Formulas
RangeFormula
E2:E27E2=IF(A2="P3",IF((MOD(D2,1)+MOD(24,8)/24)>2/3+0.0000000001,WORKDAY(D2,INT(24/8)+1,'Public Holidays'!$B$1:$B$12)+MOD(D2,1)+MOD(24,8)/24-1/3,WORKDAY(D2,INT(24/8),'Public Holidays'!$B$1:$B$12)+MOD(D2,1)+MOD(24,8)/24),IF(A2="P4",IF((MOD(D2,1)+MOD(80,8)/24)>2/3+0.0000000001,WORKDAY(D2,INT(80/8)+1,'Public Holidays'!$B$1:$B$12)+MOD(D2,1)+MOD(80,8)/24-1/3,WORKDAY(D2,INT(80/8),'Public Holidays'!$B$1:$B$12)+MOD(D2,1)+MOD(80,8)/24),IF(ISBLANK(A2),"")))
F2:F27F2=IF(A2="P3",IF((MOD(D2,1)+MOD(48,8)/24)>2/3+0.0000000001,WORKDAY(D2,INT(48/8)+1,'Public Holidays'!$B$1:$B$12)+MOD(D2,1)+MOD(48,8)/24-1/3,WORKDAY(D2,INT(48/8),'Public Holidays'!$B$1:$B$12)+MOD(D2,1)+MOD(48,8)/24),IF(A2="P4",IF((MOD(D2,1)+MOD(104,8)/24)>2/3+0.0000000001,WORKDAY(D2,INT(104/8)+1,'Public Holidays'!$B$1:$B$12)+MOD(D2,1)+MOD(104,8)/24-1/3,WORKDAY(D2,INT(104/8),'Public Holidays'!$B$1:$B$12)+MOD(D2,1)+MOD(104,8)/24),IF(ISBLANK(A2),"")))
Cells with Conditional Formatting
CellConditionCell FormatStop If True
D39:D65Cell ValueduplicatestextNO


PUBLIC HOLIDAYS SHEET:

MASTER EM SLA Report w incorrect data.xlsx
AB
1Day after New Year’s Day1/01/2023
23/01/2023
32/01/2023
4Waitangi Day6/02/2023
5Good Friday7/04/2023
6Easter Monday10/04/2023
7Anzac Day25/04/2023
8King’s Birthday5/06/2023
9Matariki14/07/2023
10Labour Day23/10/2023
11Christmas Day25/12/2023
12Boxing Day26/12/2023
13
14
Public Holidays
 
@Stelio , I just had a thought What happens when the work order arrives between 800 and 1600 on a weekend day?
Then the formula should start counting the response time from Monday morning 8am.
So for a P3 the response time should be Wednesday 4pm. Same should apply for the timeframes for rectification for P3 and also timeframes for P4.

Hope this makes sense?
 
Upvote 0

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
Then the formula should start counting the response time from Monday morning 8am.
So for a P3 the response time should be Wednesday 4pm. Same should apply for the timeframes for rectification for P3 and also timeframes for P4.

Hope this makes sense?
okay, I expected that. but it requires a tweak in the formulas, i think.
 
Upvote 0
Okay, I had a lot of unfound errors so please ignore the above. I still have two differences with your expected results though:

mr excel questions 15.xlsm
ABCDEFGHIJK
46PriorityResponse StatusRectification StatusWork Order Issued Date TimeResponse Due DateCompletion Due Date TimeNew Response Due DateNew Completion Due Date
47P4CompletedIn ProgressFriday 2023-02-03 14:10:47Friday 2023-02-17 14:10:47Wednesday 2023-02-22 14:10:47Monday 2023-02-20 14:10:47Thursday 2023-02-23 14:10:47Day after New Year’s Day2023-01-01 00:00
48P4CompletedIn ProgressFriday 2023-02-03 14:11:20Friday 2023-02-17 14:11:20Wednesday 2023-02-22 14:11:20Monday 2023-02-20 14:11:20Thursday 2023-02-23 14:11:202023-01-03 00:00
49P3OverdueIn ProgressTuesday 2023-02-07 17:41:40Friday 2023-02-10 16:00:00Wednesday 2023-02-15 16:00:00Friday 2023-02-10 16:00:00Wednesday 2023-02-15 16:00:002023-01-02 00:00
50P3CompletedCompletedSaturday 2023-02-11 11:40:32Wednesday 2023-02-15 16:00:00Monday 2023-02-20 16:00:00Wednesday 2023-02-15 16:00:00Monday 2023-02-20 16:00:00Waitangi Day2023-02-06 00:00
51P3CompletedCompletedSunday 2023-02-12 10:03:38Wednesday 2023-02-15 16:00:00Monday 2023-02-20 16:00:00Wednesday 2023-02-15 16:00:00Monday 2023-02-20 16:00:00Good Friday2023-04-07 00:00
52P3CompletedCompletedSunday 2023-02-12 11:20:18Wednesday 2023-02-15 16:00:00Monday 2023-02-20 16:00:00Wednesday 2023-02-15 16:00:00Monday 2023-02-20 16:00:00Easter Monday2023-04-10 00:00
53P4CompletedCompletedSaturday 2023-02-18 00:13:01Friday 2023-03-03 16:00:00Wednesday 2023-03-08 16:00:00Friday 2023-03-03 16:00:00Wednesday 2023-03-08 16:00:00Anzac Day2023-04-25 00:00
54P3OverdueIn ProgressTuesday 2023-02-21 10:43:55Friday 2023-02-24 10:43:55Wednesday 2023-03-01 10:43:55Friday 2023-02-24 10:43:55Wednesday 2023-03-01 10:43:55King’s Birthday2023-06-05 00:00
55P4OverdueIn ProgressThursday 2023-02-23 09:47:31Thursday 2023-03-09 09:47:31Tuesday 2023-03-14 09:47:31Thursday 2023-03-09 09:47:31Tuesday 2023-03-14 09:47:31Matariki2023-07-14 00:00
56P4OverdueIn ProgressThursday 2023-02-23 11:00:49Thursday 2023-03-09 11:00:49Tuesday 2023-03-14 11:00:49Thursday 2023-03-09 11:00:49Tuesday 2023-03-14 11:00:49Labour Day2023-10-23 00:00
57P4OverdueIn ProgressThursday 2023-02-23 11:02:27Thursday 2023-03-09 11:02:27Tuesday 2023-03-14 11:02:27Thursday 2023-03-09 11:02:27Tuesday 2023-03-14 11:02:27Christmas Day2023-12-25 00:00
58P4OverdueIn ProgressThursday 2023-02-23 15:12:49Thursday 2023-03-09 15:12:49Tuesday 2023-03-14 15:12:49Thursday 2023-03-09 15:12:49Tuesday 2023-03-14 15:12:49Boxing Day2023-12-26 00:00
59P4CompletedIn ProgressFriday 2023-02-24 14:08:56Friday 2023-03-10 14:08:56Wednesday 2023-03-15 14:08:56Friday 2023-03-10 14:08:56Wednesday 2023-03-15 14:08:56
60P4OverdueIn ProgressFriday 2023-02-24 15:31:34Friday 2023-03-10 15:31:34Wednesday 2023-03-15 15:31:34Friday 2023-03-10 15:31:34Wednesday 2023-03-15 15:31:34
61P4OverdueIn ProgressFriday 2023-02-24 15:46:37Friday 2023-03-10 15:46:37Wednesday 2023-03-15 15:46:37Friday 2023-03-10 15:46:37Wednesday 2023-03-15 15:46:37
62P3CompletedCompletedSaturday 2023-02-25 09:31:51Wednesday 2023-03-01 16:00:00Monday 2023-03-06 16:00:00Wednesday 2023-03-01 16:00:00Monday 2023-03-06 16:00:00
63P3CompletedCompletedSaturday 2023-02-25 07:34:53Wednesday 2023-03-01 16:00:00Monday 2023-03-06 16:00:00Wednesday 2023-03-01 16:00:00Monday 2023-03-06 16:00:00
64P3CompletedCompletedSunday 2023-02-26 05:34:34Wednesday 2023-03-01 16:00:00Monday 2023-03-06 16:00:00Wednesday 2023-03-01 16:00:00Monday 2023-03-06 16:00:00
65P3CompletedCompletedSunday 2023-02-26 06:51:51Wednesday 2023-03-01 16:00:00Monday 2023-03-06 16:00:00Wednesday 2023-03-01 16:00:00Monday 2023-03-06 16:00:00
66P4In ProgressIn ProgressMonday 2023-02-27 16:06:00Monday 2023-03-13 16:00:00Thursday 2023-03-16 16:00:00Monday 2023-03-13 16:00:00Thursday 2023-03-16 16:00:00
67P4In ProgressIn ProgressMonday 2023-02-27 16:30:41Monday 2023-03-13 16:00:00Thursday 2023-03-16 16:00:00Monday 2023-03-13 16:00:00Thursday 2023-03-16 16:00:00
68P4In ProgressIn ProgressMonday 2023-02-27 16:48:00Monday 2023-03-13 16:00:00Thursday 2023-03-16 16:00:00Monday 2023-03-13 16:00:00Thursday 2023-03-16 16:00:00
69P4In ProgressIn ProgressTuesday 2023-02-28 14:40:33Tuesday 2023-03-14 14:40:33Friday 2023-03-17 14:40:33Tuesday 2023-03-14 14:40:33Friday 2023-03-17 14:40:33
70P4In ProgressIn ProgressTuesday 2023-02-28 18:30:47Tuesday 2023-03-14 16:00:00Friday 2023-03-17 16:00:00Tuesday 2023-03-14 16:00:00Friday 2023-03-17 16:00:00
71P4In ProgressIn ProgressTuesday 2023-02-28 18:37:14Tuesday 2023-03-14 16:00:00Friday 2023-03-17 16:00:00Tuesday 2023-03-14 16:00:00Friday 2023-03-17 16:00:00
72P3CompletedIn ProgressTuesday 2023-02-28 19:58:59Friday 2023-03-03 16:00:00Wednesday 2023-03-08 16:00:00Friday 2023-03-03 16:00:00Wednesday 2023-03-08 16:00:00
Export
Cell Formulas
RangeFormula
G47:G72G47=WORKDAY.INTL($D47,IF($A47="P4",10,3),1,PublicHolidays) + IF(OR(WEEKDAY($D47)=1,WEEKDAY($D47)=7),16/24, IF(AND(MOD($D47,1)<=16/24,MOD($D47,1)>=8/24),MOD($D47,1),16/24))
H47:H72H47=WORKDAY.INTL($D47,IF($A47="P4",13,6),1,PublicHolidays) + IF(OR(WEEKDAY($D47)=1,WEEKDAY($D47)=7),16/24, IF(AND(MOD($D47,1)<=16/24,MOD($D47,1)>=8/24),MOD($D47,1),16/24))
Named Ranges
NameRefers ToCells
PublicHolidays=Export!$K$47:$K$58G47:H72
Cells with Conditional Formatting
CellConditionCell FormatStop If True
H47:H72Expression=ROUND(F47,6)<>ROUND(H47,6)textNO
F47:F72Expression=ROUND(F47,6)<>ROUND(H47,6)textNO
E47:E72Expression=ROUND(E47,6)<>ROUND(G47,6)textNO
G47:G74Expression=ROUND(E47,6)<>ROUND(G47,6)textNO
 
Upvote 0
Hi awoohaw!

Your formula works great and give the exact expected results. The differences in your two results are due to my error inputting manually the expected results as there is a public holiday on 6.02 which I missed.

Now for the final challenge.
How do I now pair these formulas so they execute for all the priorities. I need to pair formula 1&2 and then pair formula 3&4.
Very excited to get this one working!

Formula 1

=IF(A47="P2",D47+(4/24),IF(A47="P1",D27+(2/24),IF(ISBLANK(A27),"")))

Formula 2

=WORKDAY.INTL($D47,IF($A47="P4",10,3),1,PublicHolidays) + IF(OR(WEEKDAY($D47)=1,WEEKDAY($D47)=7),16/24, IF(AND(MOD($D47,1)<=16/24,MOD($D47,1)>=8/24),MOD($D47,1),16/24))


Formula 3

=IF(A47="P2",D27+(8/24),IF(A47="P1",D47+(4/24),IF(ISBLANK(A27),"")))

Formula 4

=WORKDAY.INTL($D47,IF($A47="P4",13,6),1,PublicHolidays) + IF(OR(WEEKDAY($D47)=1,WEEKDAY($D47)=7),16/24, IF(AND(MOD($D47,1)<=16/24,MOD($D47,1)>=8/24),MOD($D47,1),16/24))
 
Upvote 0
im confused ... what are formulas 1 and 3? What cells do they go in? in both formulas 1 and 3 you refer to cells in row 47 and row 27? (Should that be only row 47).

Or are you saying you want to combine the value check for cells in COLUMN A into the formulas in COLUMNS E and F?

Also, I learned another method of entering the time calculation for the hour checks. Instead of 16/24 you could use Time(16,0,0) it is more key strokes but it is more easily understood for debugging.
 
Upvote 0
im confused ... what are formulas 1 and 3? What cells do they go in? in both formulas 1 and 3 you refer to cells in row 47 and row 27? (Should that be only row 47).

Or are you saying you want to combine the value check for cells in COLUMN A into the formulas in COLUMNS E and F?

Also, I learned another method of entering the time calculation for the hour checks. Instead of 16/24 you could use Time(16,0,0) it is more key strokes but it is more easily understood for debugging.
Hi awoohaw,

Apologies, I copied the formulas and forgot to change the cell references. See below. The additional formula for each repsonse and rectification is for the P1'a and P'2 which works fine, just needs to be combined to process all the priorities.

=IF(A47="P2",D47+(4/24),IF(A47="P1",D47+(2/24),IF(ISBLANK(A47),"")))

Formula 2

=WORKDAY.INTL($D47,IF($A47="P4",10,3),1,PublicHolidays) + IF(OR(WEEKDAY($D47)=1,WEEKDAY($D47)=7),16/24, IF(AND(MOD($D47,1)<=16/24,MOD($D47,1)>=8/24),MOD($D47,1),16/24))


Formula 3

=IF(A47="P2",D47+(8/24),IF(A47="P1",D47+(4/24),IF(ISBLANK(A47),"")))

Formula 4

=WORKDAY.INTL($D47,IF($A47="P4",13,6),1,PublicHolidays) + IF(OR(WEEKDAY($D47)=1,WEEKDAY($D47)=7),16/24, IF(AND(MOD($D47,1)<=16/24,MOD($D47,1)>=8/24),MOD($D47,1),16/24))
 
Upvote 0
ok, not a problem, i just wanted to be sure.

But, you didn't answer the more important question.. Do you need P1 and P2 considerations in the calculation in Columns E and F? If not where?
 
Upvote 0
ok, not a problem, i just wanted to be sure.

But, you didn't answer the more important question.. Do you need P1 and P2 considerations in the calculation in Columns E and F? If not where?
Yes please - columns E and F need to calculate P1's and P'2 as well. I split this out as these were working and only had an issue with P3's and P4's.
Hope this makes sense?
 
Upvote 0
Hi awoohaw.

I found an issue where if the Work Order is issued on a weekend, the response times and dates are correct - however, when it's raised out of hours i.e. on a Monday 6am the formulas are adding one extra business day to the response due and rectification due. I tried changing the parameters IF($A2="P4",10,3) and IF($A2="P4",13,6) to a 2 and a 5 but this just reversed the issue where out of hours is fine but weekends is incorrect. Any idea on this one?

MASTER EM SLA Report w incorrect data.xlsx
ABCDEFGHI
1PriorityResponse StatusRectification StatusWork Order Issued Date TimeResponse Due DateCompletion Due Date TimeResponse Due Result ExpectedRect. Due Result ExpectedComment
2P3CompletedIn Progress3/11/2023 12:10:47 AM3/15/2023 4:00:00 PM3/20/2023 4:00:00 PMCorrectCorrect
3P4CompletedIn Progress3/11/2023 12:10:47 AM3/24/2023 4:00:00 PM3/29/2023 4:00:00 PMCorrectCorrect
4P3CompletedIn Progress3/13/2023 12:10:47 AM3/16/2023 4:00:00 PM3/21/2023 4:00:00 PM3/15/2023 4:00:00 PM3/20/2023 4:00:00 PMFormula is adding an extra business day to P3's when raised out of hours.
5P4CompletedIn Progress3/13/2023 7:59:00 AM3/27/2023 4:00:00 PM3/30/2023 4:00:00 PM3/24/2023 4:00:00 PM3/29/2023 4:00:00 PMFormula is adding extra business day to P4's when raised out of hours
6P3CompletedCompleted3/13/2023 6:00:00 AM3/16/2023 6:00:00 AM3/21/2023 6:00:00 AM
7P3CompletedCompleted2/12/2023 11:20:18 AM2/15/2023 11:20:18 AM2/20/2023 11:20:18 AM
8P4CompletedCompleted2/18/2023 12:13:01 AM3/3/2023 12:13:01 AM3/8/2023 12:13:01 AM
9P3OverdueIn Progress2/21/2023 10:43:55 AM2/24/2023 10:43:55 AM3/1/2023 10:43:55 AM
10P4OverdueIn Progress2/23/2023 9:47:31 AM3/9/2023 9:47:31 AM3/14/2023 9:47:31 AM
11P4OverdueIn Progress2/23/2023 11:00:49 AM3/9/2023 11:00:49 AM3/14/2023 11:00:49 AMCurrent Formulas in column E and F
12P4OverdueIn Progress2/23/2023 11:02:27 AM3/9/2023 11:02:27 AM3/14/2023 11:02:27 AM
13P4OverdueIn Progress2/23/2023 3:12:49 PM3/9/2023 3:12:49 PM3/14/2023 3:12:49 PM
14P4CompletedIn Progress2/24/2023 2:08:56 PM3/10/2023 2:08:56 PM3/15/2023 2:08:56 PM
15P4OverdueIn Progress2/24/2023 3:31:34 PM3/10/2023 3:31:34 PM3/15/2023 3:31:34 PM
16P4OverdueIn Progress2/24/2023 3:46:37 PM3/10/2023 3:46:37 PM3/15/2023 3:46:37 PM
17P3CompletedCompleted2/25/2023 5:31:51 AM3/1/2023 5:31:51 AM3/6/2023 5:31:51 AM
18P3CompletedCompleted2/25/2023 7:34:53 AM3/1/2023 7:34:53 AM3/6/2023 7:34:53 AM
19P3CompletedCompleted2/26/2023 5:34:34 AM3/1/2023 5:34:34 AM3/6/2023 5:34:34 AM
20P3CompletedCompleted2/26/2023 6:51:51 AM3/1/2023 6:51:51 AM3/6/2023 6:51:51 AM
21P4In ProgressIn Progress2/27/2023 4:06:00 PM3/14/2023 8:06:00 AM3/17/2023 8:06:00 AM
22P4In ProgressIn Progress2/27/2023 4:30:41 PM3/14/2023 8:30:41 AM3/17/2023 8:30:41 AM
23P4In ProgressIn Progress2/27/2023 4:48:00 PM3/14/2023 8:48:00 AM3/17/2023 8:48:00 AM
24P4In ProgressIn Progress2/28/2023 2:40:33 PM3/14/2023 2:40:33 PM3/17/2023 2:40:33 PM
25P4In ProgressIn Progress2/28/2023 6:30:47 PM3/15/2023 10:30:47 AM3/20/2023 10:30:47 AM
26P4In ProgressIn Progress2/28/2023 6:37:14 PM3/15/2023 10:37:14 AM3/20/2023 10:37:14 AM
27P3CompletedIn Progress2/28/2023 7:58:59 PM3/6/2023 11:58:59 AM3/9/2023 11:58:59 AM
28
29For P3 (Column A)
30Column E needs to be 3 full business days after Column D if Column D lands on a public holiday, weekend or out of hours (business day starts at 8am and ends 4pm) OR 24 business hours from date/time of Column F if Column D is during business hours.
31Column F needs to be 6 full business days after Column D if Column D lands on a public holiday, weekend or out of hours (business day starts at 8am and ends 4pm) OR 48 business hours from date/time of Column F if Column D is during business hours.
32
33For P4 (Column A)
34Column E needs to be 10 full business days after Column D if Column D lands on a public holiday, weekend or out of hours (business day starts at 8am and ends 4pm) OR 80 business hours from date/time of Column F if Column D is during business hours.
35Column F needs to be 13 full business days after Column D if Column D lands on a public holiday, weekend or out of hours (business day starts at 8am and ends 4pm) OR 104 business hours from date/time of Column F if Column D is during business hours.
Export
Cell Formulas
RangeFormula
E2:E5E2=WORKDAY.INTL($D2,IF($A2="P4",10,3),1,'Public Holidays'!B1:B12)+IF(OR(WEEKDAY($D2)=1,WEEKDAY($D2)=7),16/24,IF(AND(MOD($D2,1)<=16/24,MOD($D2,1)>=8/24),MOD($D2,1),16/24))
F2F2=WORKDAY.INTL($D2,IF($A2="P4",13,6),1,'Public Holidays'!B1:B12)+IF(OR(WEEKDAY($D2)=1,WEEKDAY($D2)=7),16/24,IF(AND(MOD($D2,1)<=16/24,MOD($D2,1)>=8/24),MOD($D2,1),16/24))
F3:F5F3=WORKDAY.INTL($D3,IF($A3="P4",13,6),1,'Public Holidays'!B2:B13)+IF(OR(WEEKDAY($D3)=1,WEEKDAY($D3)=7),16/24, IF(AND(MOD($D3,1)<=16/24,MOD($D3,1)>=8/24),MOD($D3,1),16/24))
E6:E27E6=IF(A6="P3",IF((MOD(D6,1)+MOD(24,8)/24)>2/3+0.0000000001,WORKDAY(D6,INT(24/8)+1,'Public Holidays'!$B$1:$B$12)+MOD(D6,1)+MOD(24,8)/24-1/3,WORKDAY(D6,INT(24/8),'Public Holidays'!$B$1:$B$12)+MOD(D6,1)+MOD(24,8)/24),IF(A6="P4",IF((MOD(D6,1)+MOD(80,8)/24)>2/3+0.0000000001,WORKDAY(D6,INT(80/8)+1,'Public Holidays'!$B$1:$B$12)+MOD(D6,1)+MOD(80,8)/24-1/3,WORKDAY(D6,INT(80/8),'Public Holidays'!$B$1:$B$12)+MOD(D6,1)+MOD(80,8)/24),IF(ISBLANK(A6),"")))
F6:F27F6=IF(A6="P3",IF((MOD(D6,1)+MOD(48,8)/24)>2/3+0.0000000001,WORKDAY(D6,INT(48/8)+1,'Public Holidays'!$B$1:$B$12)+MOD(D6,1)+MOD(48,8)/24-1/3,WORKDAY(D6,INT(48/8),'Public Holidays'!$B$1:$B$12)+MOD(D6,1)+MOD(48,8)/24),IF(A6="P4",IF((MOD(D6,1)+MOD(104,8)/24)>2/3+0.0000000001,WORKDAY(D6,INT(104/8)+1,'Public Holidays'!$B$1:$B$12)+MOD(D6,1)+MOD(104,8)/24-1/3,WORKDAY(D6,INT(104/8),'Public Holidays'!$B$1:$B$12)+MOD(D6,1)+MOD(104,8)/24),IF(ISBLANK(A6),"")))


Public Holidays:

MASTER EM SLA Report w incorrect data.xlsx
AB
1Day after New Year’s Day1/01/2023
23/01/2023
32/01/2023
4Waitangi Day6/02/2023
5Good Friday7/04/2023
6Easter Monday10/04/2023
7Anzac Day25/04/2023
8King’s Birthday5/06/2023
9Matariki14/07/2023
10Labour Day23/10/2023
11Christmas Day25/12/2023
12Boxing Day26/12/2023
Public Holidays
 
Upvote 0

Forum statistics

Threads
1,215,046
Messages
6,122,854
Members
449,096
Latest member
Erald

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