Function Dates Times Class

WorkDays

Add a number of business days to a date, taking into account holidays. Similar to the AddBusinessDays function, but takes into account holidays, and slightly different when vDate is on a weekend.

Signature (Visual Basic / VBA)

Public Function WorkDays( _
      ByVal vDate As Variant _
    , ByVal vAddBusinessDays As Variant _
    , ParamArray vHolidays() As Variant _
    ) As Variant

Code Example

    WorkDays(#1/1/99#, 45) = #3/5/99#
    WorkDays(#1/1/99#, -45) = #10/30/98#
    WorkDays(#1/1/99#, 45, Array(#2/22/99#, #3/15/99#)) = #3/8/99#

Parameters

Parameter Description
vDate The date to which a number of business days are added. Function returns Null if vDate is Null or cannot be interpreted as a Date. The time component of vDate (if any) is ignored.
vAddBusinessDays The number of business days to be added to vDate. Function returns Null if vDate is Null or cannot be fixed up to a number. vAddBusinessDays can be negative, in which case a number of business days will be subtracted from vDate. vAddBusinessDays is truncated to a Long Integer number.
vHolidays Optional holidays that are NOT to be considered work days. Can be numbers, one-dimensional numeric arrays, one-dimensional Variant arrays, one-dimensional Variant arrays with embedded arrays, or any combination of these. Any duplicate holidays within vHolidays will be ignored.

Notes & Version History

Summary This function considers work days to be the weekdays (Monday through Friday), minus any holidays that occur on a weekday.
Note This function returns the exact same results as the Microsoft Excel WORKDAY function.
v2.0 Addition This function is new to this version of Entisoft Tools.