Calculating Next Working Day

reberryjr

Well-known Member
Joined
Mar 16, 2017
Messages
714
Office Version
  1. 365
Platform
  1. Windows
I have several different categories of work in a spreadsheet, where not all categories have the same SLA for completion. I've been using this formula for the past few months, and there hasn't been an issue, until last Friday. Essentially, a record came in with a start date of 11/22/18. That record has a SLA of 1 day. Because 11/22/18 was a holiday, the SLA date should have been returned as 11/23/18. Instead, this formula is returning the date of 11/24/18, which is a Saturday. I always understood that the Workday function automatically excluded Saturday and Sunday.

Thoughts on where I went wrong?

Code:
=WORKDAY(D2,1+(WEEKDAY(D2,1)>6),Variables!D$2:D$11)+COUNTIF(Variables!D$2:D$11,D2)
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
It doesnt make a whole lot of sense to me what you have there. If the date in D2 is a saturday you add 2 days. Why? Then you add a countif if the date is in the holiday list. Why? Dont you just need:

=WORKDAY(D2,1,Variables!$D$2:$D$11)
 
Upvote 0
The 2 days would be added to the Saturday, to start the SLA period on Monday. Essentially, if the record is received on a Saturday, Sunday, or a Holiday listed in the Variables tab; the SLA start date should be the next working day. Hope that helps explain it.
 
Upvote 0
Thats what the provided formula does. If you add 1 day in a workday formula it provides the next working day which naturally excludes weekends and holidays.
 
Upvote 0
How does:

=WORKDAY(D2,1+Or(WEEKDAY(D2,1)>6,COUNTIF(Variables!D$2:D$11,D2)),Variables!D$2:D$11)

do what you asked??

D2 is 11/22/2018
11/22/2018 is in the holiday list.

You wanted to produce:

11/23/2018

That formula doesnt.
 
Upvote 0
Because 11/22 is in the holiday list, the formula is starting the SLA off on 11/23, with an end result of 11/26, skipping the weekend.
 
Upvote 0
Ok so what happens if you recieve the SLA date on a weekend? Move to the monday then add a day?
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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