Nov 20 2023 10:00 AM
I'm trying to take a select date and add a certain number of days to it and output the new date but the output date must be a weekday. I am trying to use an if statement with nested weekday and workday arguments that looks like this =IF(WEEKDAY(WORKDAY(D2,C2))>5,WORKDAY(WORKDAY(D2,C2),2), WORKDAY(D2,C2)). This formula seems to not count weekends though and gives me a date way in the future. Any thoughts?
Nov 20 2023 11:16 AM
The WORKDAY function is designed to exclude weekends by default. If you want to include weekends but adjust to the closest weekday if the result falls on a weekend, you can modify your formula as follows:
=IF(WEEKDAY(D2+C2)>5, D2+C2+CHOOSE(WEEKDAY(D2+C2),2,2,2,2,2,4,4), D2+C2)
Explanation:
This formula should give you the next weekday if the result falls on a weekend. Adjust the starting date (D2) and the number of days to add (C2) according to your needs.
The text and steps were edited with the help of AI.
My answers are voluntary and without guarantee!
Hope this will help you.
Was the answer useful? Mark as best response and Like it!
This will help all forum participants.
Nov 20 2023 11:28 AM
@NikolinoDE this helped to get a lot closer to the date however when I add my first date which is 11/17/2023 with the number of days which is 63.33 it outputs 1/23/24 when it if you simply add them, it would be 1/19/24 which is a Friday. I'm a little confused why its skipping Friday.
Nov 20 2023 11:42 AM
Nov 20 2023 01:22 PM
Nov 20 2023 10:07 PM
If you want to push Sunday to Monday, you can modify the CHOOSE statement as follows:
=IF(WEEKDAY(D2+C2)>5, D2+C2+CHOOSE(WEEKDAY(D2+C2),0,0,0,0,0,1,1), D2+C2)
In this modified version, Sunday (weekday number 1) is adjusted by adding 1 day, so it falls on Monday. The other days (Monday to Friday) are adjusted by adding 0 days.
Nov 21 2023 07:42 AM
Solution@R_Caron418 See the attached workbook, especially the notes on the _Info worksheet.
(Note that the column headings for columns E through I are derived from the formulas directly below them.)
Nov 21 2023 07:52 AM
Nov 21 2023 07:42 AM
Solution@R_Caron418 See the attached workbook, especially the notes on the _Info worksheet.
(Note that the column headings for columns E through I are derived from the formulas directly below them.)