Find nearest WORKDAY before a date

psycoperl

Active Member
Joined
Oct 23, 2007
Messages
339
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
  2. MacOS
  3. Web
I would like to find the workday before a certain date.
Workdays are defined normally as Monday to Friday, but I would also like to account for holidays both standard and internal company holidays.

I have a list of dates in an excel sheet that are the internal company holidays.


For example December 25, 2024 is a Wednesday which is Christmas as we are closed. However due to Christmas Eve Dec 24 also being an internal holiday we are not open on that date either. So for December 25 the nearest workdate is December 23, 2024.

Another example is Feb 19, 2024 was Presidents Day (US) which was a Monday, so the nearest work day is Friday, Feb 16, 2024.
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
How about
Excel Formula:
=workday(a2+1,-1,Holidays!a2:a20)
Where A2 is the date & holidays is your list of holidays
 
Upvote 0
How about
Excel Formula:
=workday(a2+1,-1,Holidays!a2:a20)
Where A2 is the date & holidays is your list of holidays
Hi Fluff - Using your formula I got a #VALUE! Error

Book1
ABCEGHIJKL
1DateTimeExcelDateTimeIs During EDTDay Of Week
2Wednesday, March 6, 20249:30:00 AM3/6/2024 9:30FALSE3#VALUE!
3Wednesday, March 6, 202411:30:00 AM3/6/2024 11:30FALSE3#VALUE!
4Wednesday, March 6, 20241:30:00 PM3/6/2024 13:30FALSE3#VALUE!
Sheet1
Cell Formulas
RangeFormula
H2:H4H2=A2+B2
I2:I4I2=MATCH(A2,DATE(YEAR(A2),{1,3,11},{1,15,8})-WEEKDAY(DATE(YEAR(A2),{1,3,11},7)))=2
J2:J4J2=WEEKDAY(A2,11)
L2:L4L2=WORKDAY(A2+1,-1,Holidays!$A$1:$A$200)


Book1
A
1HolidayList
29/4/2023
310/9/2023
411/7/2023
511/10/2023
611/11/2023
711/23/2023
811/24/2023
912/24/2023
1012/25/2023
1112/29/2023
1212/30/2023
1312/31/2023
141/1/2024
151/15/2024
162/12/2024
172/19/2024
183/29/2024
195/27/2024
206/19/2024
216/28/2024
227/4/2024
237/12/2024
247/19/2024
257/26/2024
268/2/2024
278/9/2024
288/16/2024
2910/14/2024
3011/11/2024
3111/28/2024
3211/29/2024
3312/24/2024
Holidays
 
Upvote 0
how about
=WORKDAY(A2-1,1,$E$2:$E$12)
where E2:E12 are the holidays and internal dates

Book20
ABCDE
1workdayHolidays
22/1/242/1/242/5/24
32/2/242/2/24
42/3/242/6/24
52/4/242/6/24
62/5/242/6/24
72/6/242/6/24
82/7/242/7/24
92/8/242/8/24
102/9/242/9/24
112/10/242/12/24
122/11/242/12/24
132/12/242/12/24
142/13/242/13/24
152/14/242/14/24
162/15/242/15/24
172/16/242/16/24
182/17/242/19/24
192/18/242/19/24
202/19/242/19/24
212/20/242/20/24
222/21/242/21/24
Sheet1
Cell Formulas
RangeFormula
B2:B22B2=WORKDAY(A2-1,1,$E$2:$E$12)
 
Upvote 0
It needs to be
Excel Formula:
=WORKDAY(A2+1,-1,Holidays!$A$2:$A$200)
as you have text in A1 on the holiday sheet.
 
Upvote 0
It needs to be
Excel Formula:
=WORKDAY(A2+1,-1,Holidays!$A$2:$A$200)
as you have text in A1 on the holiday sheet.
ahh -- I got it working with =WORKDAY(A2,-2,Holidays!$A$2:$A$300)
 
Upvote 0
That will return a Monday if the start date is Wednesday, is that what you wanted?
 
Upvote 0

Forum statistics

Threads
1,223,885
Messages
6,175,179
Members
452,615
Latest member
bogeys2birdies

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