WORKDAY and holidays
you need a UDF to do this
Option Explicit
Function WorkingDays(startdate As Date, nDays As Long, Optional holidays As
Range) As Date
' INPUT : start date
' : number of days (n)
' : range of holidays (optional)
'OUTPUT: Date n days from Start Date adjusting fir holidays
Dim i As Long
Dim thisDate As Date
thisDate = startdate
i = 1
Do Until i = nDays
If Not isHoliday(thisDate, holidays) Then
i = i + 1
End If
thisDate = thisDate + 1
Loop
WorkingDays = thisDate
End Function
Function isHoliday(sDate As Date, source As Range) As Boolean
On Error Resume Next
isHoliday = WorksheetFunction.Match(sDate * 1, source, False) < 0
End Function
"Jock" wrote in message
...
Exactly! I want it to include weekends, not ignore them.
I.E. 14 days from 01/01/09 will be 14/01/09 not 21/01/09 as it is using
WORKDAY
--
Traa Dy Liooar
Jock
"Stefi" wrote:
You are wrong! WORKDAY does take care both of weekends and holidays!
Check it
again!
Regards,
Stefi
€˛Jock€¯ ezt Ć*rta:
Hi,
I need to have a date formula which will not ignore weekends and will
take
into account a list of holiday dates.
WORKDAY takes care of the holiday list but ignores weekends.
Is there another function that will include weekends AND holidays?
p.s. any weekends within the holiday dates can be ignored.
Thanks
--
Traa Dy Liooar
Jock
|