Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Workdays
Is there a way to determine the number of workdays in a given month?
|
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Sum Workdays | Excel Worksheet Functions | |||
Workdays | Excel Worksheet Functions | |||
Net Workdays | Excel Discussion (Misc queries) | |||
Workdays | Excel Worksheet Functions | |||
Workdays | Excel Discussion (Misc queries) |