← Prev in month ← Prev in thread
Next in thread → Next in month →

NETWORKDAYS etc to Stefan Nikolas)

From
David A. Wheeler <>
Date
2007-02-14T20:48:13+00:00
ID
Thread
NETWORKDAYS etc to Stefan Nikolas)
> The existing function deals with whole days. Excel explicitly defines it that way. Even if you give it a date serial number that is noon one day to 5pm another day, it will not return a fractional number of workdays. I'm not suggesting we expand it to include such a feature. My interest was purely in the internationalization aspect, that the legal definition of the work week in some nations is not M-F.  So, we handle it by simply adding an optional enumeration value which defines what a weekend is.  0 (default) = Sat/Sun, 1=Thurs/Friday and 2=Friday/Sat.

> If we wanted the full generality, we could have instead an optional array parameter of 7 values, evaluated as booleans for whether that day of the week is a weekend or not.  That has the advantage of working for partial week schedules as well as 1-day weekends.

You can encode this as one number while allowing more generality - encode as bits.
E.G., if Sunday=1, Monday=2, Tuesday=4, Wednesday=8, Thursday=16, Friday=32, Saturday=64, then:
Skip Saturday and Sunday = 65
Skip Thursday and Friday=48
Skip Friday and Saturday=33
Skip ONLY Sunday=1

--- David A. Wheeler
← Prev in month ← Prev in thread
Next in thread → Next in month →