LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
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?


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem using newly created user function in Excel 2003 Richard Excel Discussion (Misc queries) 10 January 22nd 07 12:44 AM
List of functions contained in the add-ins, esp. Analysis Toolpak Neil Goldwasser Excel Worksheet Functions 3 January 12th 07 12:43 PM
FUNCTION GETPIVOTDATA EXCEL 2003 v EXCEL 2004 FOR MAC FRANCISCO PEREZ-LANDAETA Excel Worksheet Functions 0 July 6th 06 12:56 PM
Excel option to store trendline's coefficients in cells for use Miguel Saldana Charts and Charting in Excel 9 June 20th 05 08:45 PM
I cant use englisch function names in a swedich version of excel PE Excel Discussion (Misc queries) 2 December 7th 04 01:00 AM


All times are GMT +1. The time now is 08:26 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"