Return workdays in a month
This tutorial shows how to return the number of working days in a month using an Excel formula or VBA
Example: Return workdays in a month
=NETWORKDAYS(EOMONTH(B5,-1)+1,EOMONTH(B5,0),F5:F12)
|
This formula uses the Excel NETWORKDAYS and EOMONTH functions to return the number of working days in a specific month. It also takes into consideration the holidays that are in that particular month. With this formula you can enter whatever day of the month as the date, it will still return the total number of workdays in a month.
|
Sub Return_workdays_in_month()
'declare variables
Dim ws As Worksheet
Dim ws As Worksheet
Set ws = Worksheets("Analysis")
'return the number of working days in a month
ws.Range("C5") = WorksheetFunction.NetworkDays(WorksheetFunction.EoMonth(ws.Range("B5"), -1) + 1, WorksheetFunction.EoMonth(ws.Range("B5"), 0), ws.Range("F5:F12"))
End Sub
EXPLANATION
This tutorial shows how to return the number of working days in a specific month through the use of an Excel formula or VBA.
The Excel and VBA methods both use the NETWORKDAYS and EOMONTH functions to return the number of workdays in a specific month.
FORMULA
=NETWORKDAYS(EOMONTH(month,-1)+1,EOMONTH(month,0),holidays)
=NETWORKDAYS(EOMONTH(month,-1)+1,EOMONTH(month,0),holidays)
ARGUMENTS
month: The month from which you want to extract the number of working days.
holidays: A list of dates that captures the holidays to take into consideration.
month: The month from which you want to extract the number of working days.
holidays: A list of dates that captures the holidays to take into consideration.
RELATED TOPICS
Related Topic | Description | Related Topic and Description |
---|---|---|
Return next working day | How to return the next work day (business day) using Excel and VBA | |
Return next working day 6 months in the future | How to return the next work day (business day) six months in the future using Excel and VBA |