Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
cancel
Showing results for 
Search instead for 
Did you mean: 
trpatel123
Contributor III
Contributor III

Number of Working Days this year with Wednesday Holiday

Hi All,

Our company is working 6 days a week with Wednesday is a non working day.

I want working days by month for this year...

   

Date1Date2    Total         Days      Total Working       Days
01/01/201601/02/20163127
01/02/201601/03/20162925
01/03/201601/04/20163126
01/04/201601/05/20163026
01/05/201601/06/20163127
01/06/201601/07/20163025
01/07/201601/08/20163127
01/08/201601/09/20163126
01/09/201601/10/20163026
01/10/201601/11/20163127
01/11/201601/12/20163025
01/12/201601/01/20173127

    

I have Date1 and Date2 available... need to have formula for Total Working Days excluding Wednesday.

This should be at front end as I don't have access for script change and also sometimes I want to select two dates and need working days excluding number of Wednesday between those two dates.

1 Solution

Accepted Solutions
Gysbert_Wassenaar

Try: =Date2 - Date1 - Div(Date2-Date1,7) - (WeekDay(Date1)<=2)*(WeekDay(Date2)>=2)


talk is cheap, supply exceeds demand

View solution in original post

5 Replies
marcus_sommer

If you used a master-calendar you could on a month-level calculate something like this:

count({< Date = {"=match(weekday(Date), 0,1,2,4,5,6)"}>} Date)

Easier is of course to flag the working-days within the calendar, see: Master Calendar with movable holidays‌ (you would need to switch the excluding day from sunday to wednesday).

- Marcus

Gysbert_Wassenaar

Try: =Date2 - Date1 - Div(Date2-Date1,7) - (WeekDay(Date1)<=2)*(WeekDay(Date2)>=2)


talk is cheap, supply exceeds demand
trpatel123
Contributor III
Contributor III
Author

Thanks Gysbert,

This is working absolutely fine !

Can you explain the formula you have written?

trpatel123
Contributor III
Contributor III
Author

gwassenaar‌ can you please explain the logic here?

Gysbert_Wassenaar

  • Date2 - Date1 is the number of days between the two dates
  • Div(Date2 - Date1,7) is the number of whole weeks between the two dates. Every whole week will have one wednesday.
  • (WeekDay(Date1)<=2) is test that checks if the weekday number of Date1 is smaller or equal to the weekday number of wednesday. The test returns 0 (false) or -1 (true).
  • (WeekDay(Date2)>=2) is test that checks if the weekday number of Date2 is larger or equal to the weekday number of wednesday. The test returns 0 (false) or -1 (true).

The two tests are necessary to find the additional wednesday in a period that's not exactly N weeks long.

The best way to understand the expression is to create a table with start and end dates and a column for each separate component.


talk is cheap, supply exceeds demand