Date calculation exclude weekend

Hello to all, I have a situation and cannot figure it out. I have the startDate and endDate. Now in my `total` column I need to calculate the number of days but exclude the weekend days. I tried with WEEKDAY() but I got an error cuz my `total` column is a Number.  The goal is to get number of days between start date and end date but i do not want to sum the Sat and Sun. 
Thank you in advance

0 3 157
3 REPLIES 3

The below expression works but is very slow in updating for reasons unknown to me. (It calculates and shows one value and adjusts itself a few seconds later. A behavior I have never seen..)

(((HOUR([end] - [st]) / 24) / 7) * 5)
+
MOD(HOUR([end] - [st]) / 24, 7)
-
IFS(
 MOD(HOUR([end] - [st]) / 24, 7) >= (8 - WEEKDAY([ST])),2,
 MOD(HOUR([end] - [st]) / 24, 7) = (7 - WEEKDAY([ST])) ,1,
 TRUE, 0
)

 May simply be too computation intensive...

I hope others may chip in here... 

I tried your solution, and it is not working if I select Friday to Sunday. it should count only 1 day. I found this formula that uses a list of working days for a whole year.

COUNT(
SELECT(
WorkingDays[workingDays],
AND(
[workingDays] >= [startDate],
[workingDays] <= [endDate]
)
)
)

Perhaps this works to your specification.

(((HOUR([end] - [st]) / 24) / 7) * 5)
+
MOD(HOUR([end] - [st]) / 24, 7)
-
IFS(
 MOD(HOUR([end] - [st]) / 24, 7) >= (9 - WEEKDAY([ST])),2,
 MOD(HOUR([end] - [st]) / 24, 7) = (8 - WEEKDAY([ST])) ,1,
 TRUE, 0
)

TeeSee1_0-1702389985970.png

TeeSee1_1-1702390015630.png

TeeSee1_2-1702390058156.pngTeeSee1_3-1702390114753.png

I wanted to see if a solution could be developed without having to maintain a list of dates. Well, my solution still suffers from sluggish execution and not very ideal.

Glad you found a workable solution!

 

Top Labels in this Space