Solved Business day calculation

The Rev

Registered User.
Local time
Today, 16:05
Joined
Jan 15, 2003
Messages
119
Trying to get a date 14 business days in the future. Thought the "weekday" option was my help...

FourteenDay = DateAdd("w", 14, Date)
FourteenDay = Format(FourteenDay, "mmm dd, yyyy")

No dice. Apparently, "weekday" just gives you the day of the week, not a business day. Sigh. I need to get a date 14 business days from the date the script was run. No clue how to do that...

Thankd
 
Have a look at the similar threads links below this thread, at the bottom of the page.

Lots of other examples on here some including optional local holiday calendars.
 
put these in a module.
usage:
=HowManyWorkDays("1/17/21","1/24/21")


Code:
Public Function HowManyWorkDays(ByVal pvStartDate, ByVal pvEndDate)
On Error Resume Next
    HowManyWorkDays = DateDiff("d", pvStartDate, pvEndDate) + 1 - HowManyWD(pvStartDate, pvEndDate, vbSunday) - HowManyWD(pvStartDate, pvEndDate, vbSaturday)
End Function


Private Function HowManyWD(ByVal pvStartDate, ByVal pvEndDate, WD As Long)
On Error Resume Next
HowManyWD = DateDiff("ww", pvStartDate, pvEndDate, WD) - Int(WD = Weekday(pvStartDate))
End Function
 

Users who are viewing this thread

Back
Top Bottom