Randy,
You would need to modify the function to accept a fourth parameter: see the code below.
Then use it like this to move to a later date:
=DueDate(A1,10,J2:J30,TRUE)
or to move earlier date:
=DueDate(A1,10,J2:J30,FALSE)
or to have another cell value control it
=DueDate(A1,10,J2:J30,A2="Later")
(moves to a later date if cell A1 contains the string Later, earlier if it contains anything else)
HTH,
Bernie
MS Excel MVP
Function DueDate(OutDate As Date, _
DaysOut As Integer, _
Holidays As Range, _
Increase As Boolean)
Dim myRet As Variant
Dim DayChanged As Boolean
DueDate = OutDate + DaysOut
TestDate:
DayChanged = False
While Weekday(DueDate, vbMonday) > 5
DueDate = DueDate + IIf(Increase, 1, -1)
DayChanged = True
Wend
myRet = Application.Match(CLng(CDate(DueDate)), Holidays, False)
While Not IsError(myRet)
DueDate = DueDate + IIf(Increase, 1, -1)
DayChanged = True
myRet = Application.Match(CLng(CDate(DueDate)), Holidays, False)
Wend
If DayChanged Then GoTo TestDate:
End Function
Bernie I do have one more question about the solution you gave me
below. What would I have to change to have it give me a date before
the weekend and/or holiday rather than after. Some of the tasks
require action before the weekend and/or holiday.
DueDate(A1,10,J2:J30)