#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 92
Default Workdays

Is there a way to determine the number of workdays in a given month?


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,163
Default Workdays

Assuming a date (any date within the month) is in cell A1:
=NETWORKDAYS(EOMONTH(A1,-1)+1,EOMONTH(A1,0))
(does not account for holidays in this form; but that could be added if you
have a range including the dates of the holidays - see help on NETWORKDAYS
function for details)
--
- K Dales


"Steph" wrote:

Is there a way to determine the number of workdays in a given month?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Workdays

Yes with something like this
*****************
dte = Date()
'1 is Sunday, 7 is Saturday
If Weekday(dte) = 1 Or Weekday(dte) = 7 Then
IsBusinessDay = False
Else
IsBusinessDay = True
End If
****************
or if you want to get crazy then you need to take into account holidays.

Function IsBusinessDay(dte As Date) As Boolean
'Determines if a date is a business day.
Dim dbs As Database
Dim rstHoliday As Recordset
Dim strSQL As String

If Weekday(dte) = 1 Or Weekday(dte) = 7 Then
IsBusinessDay = False
Else
strSQL = "SELECT * FROM tblHolidays WHERE tblHolidays.HolidayDate = #" &
dte & "#;"
Set dbs = CurrentDb()
Set rstHoliday = dbs.OpenRecordset(strSQL)
If rstHoliday.RecordCount 0 Then
IsBusinessDay = False
Else
IsBusinessDay = True
End If
End If
End Function

You will need to have a table (tblHolidays) that lists out your company's
holidays.

"Steph" wrote:

Is there a way to determine the number of workdays in a given month?



Reply
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
Sum Workdays Frank Excel Worksheet Functions 3 January 25th 10 01:00 PM
Workdays collshops Excel Worksheet Functions 2 February 3rd 09 09:09 PM
Net Workdays Katie Excel Discussion (Misc queries) 4 September 19th 08 10:59 PM
Workdays Andrew Excel Worksheet Functions 3 September 9th 08 03:48 PM
Workdays Alpur Excel Discussion (Misc queries) 3 November 3rd 05 04:00 PM


All times are GMT +1. The time now is 01:02 AM.

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

About Us

"It's about Microsoft Excel"