![]() |
Workdays
Is there a way to determine the number of workdays in a given month?
|
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? |
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? |
All times are GMT +1. The time now is 09:06 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com