View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
theSquirrel theSquirrel is offline
external usenet poster
 
Posts: 27
Default Excel Workday Function


I tend not to rely on the Analysis Add-In because if the user doesn't
have that installed, all they will see is an error.

I found this gem somewhere online and use it anytime I need a workdays
calculation.

'@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@ #@
Function GetWorkDays(StartDate As Date, EndDate As Date) As Long
' returns the count of days between StartDate - EndDate minus
Saturdays and Sundays
' to call this from a procedure use the following syntax
' GetWorkDays (Date1, Date2)

Dim d As Long, dCount As Long
For d = StartDate To EndDate
If Weekday(d, vbMonday) < 6 Then
dCount = dCount + 1
End If
Next d
GetWorkDays = dCount
End Function
'@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@ #@

You need to keep in mind that it doesn't take holidays in to account,
but has never been wrong in my uses.

good luck.

theSquirrel


On Jan 22, 1:26 pm, Leigh wrote:
I'm trying to use the "WORKDAY" function in Excel 2003 to calculate a date,
from a given date, after a number of workdays. I can't seem to get it to
work like it should. When I type my cell references into the formula I keep
getting a NAME! error. I've even tried the tutorials provided here online
but those haven't worked either. Any suggestions?