Hello, Appsheet community,
I am looking for help. I’ve been trying for some time, but still can’t get the correct result.
I am trying to achieve this:
[Start Date] + 7 = [End Date] - Weekend (if the weekend is in range)
What I’m expecting to happen.
If [Start Date] = 12/06/2023 + 7 the [End Date] will be 20/06/2023
I’ve been trying this but the result is wrong:
[Number of days]+[Start Date]- WEEKDAY([Start Date]) + 2 + 7
Hope it makes sense.
Thank you!!
Meaning you want 7 business days BUT the Start Date could be on a weekend?
You might checkout the WORKDAY() function to see if that handles all of your scenarios.
2 Likes
The start date could be any working day and the number of days (in this case 7) is a variable as well…
Here’s another example:
13/06/2023 (Tuesday) + 5 should give me a result 19/06/2023 (Monday)
1 Like
Give WORKDAY() a try. It seems it should work.
DATE(
YEAR([Start Date]),
MONTH([Start Date]),
DAY([Start Date]) + [Number of Days] + (WEEKDAY([Start Date]) + [Number of Days] - 2) / 5 *2
)
WEEKDAY([Start Date]) + [Number of Days] - 2) / 5 * 2 calculates the number of weekends (Saturdays and Sundays) within the specified number of days and adds them to the result.
WEEKDAY([Start Date]) returns a number representing the day of the week for the start date (1 for Sunday, 2 for Monday, etc.).
WORKDAY(TODAY(), [Anzahl_Tage])
Hierbei sollte die Spalte [Anzahl_Tage] Typ Zahl sein 1 bis 7.
This is an answer from ChatGPT and it works exactly as I need:
WORKDAY(
[Start Date],
FLOOR( [Number of Days] - 1) + FLOOR((FLOOR( [Number of Days]] - 1) - 1) / 5) * 2
)