Return work hours between dates

This tutorial shows how to return the work hours that exist between two dates using an Excel formula or VBA

Example: Return work hours between dates

Return work hours between dates

METHOD 1. Return work hours between dates using Excel formula

EXCEL

=NETWORKDAYS(B7,C7,$G$7:$G$14)*$C$4
This formula uses the Excel NETWORKDAYS function to return the number of working days (business days) between two specific dates and multiplies by the working hours per day. As per this example, this formula also takes holidays into consideration.

METHOD 1. Return work hours between dates using VBA

VBA

Sub Return_work_hours_between_dates()
'declare variables
Dim ws As Worksheet
Set ws = Worksheets("Analysis")
'return the number of working hours between two dates

ws.Range("D7") = WorksheetFunction.NetworkDays(ws.Range("B7"), ws.Range("C7"), ws.Range("G7:G14")) * ws.Range("C4")

End Sub

Explanation about how to return work hours between dates

EXPLANATION

EXPLANATION

This tutorial shows how to return the number of working hours between two dates through the use of an Excel formula or VBA.
The Excel and VBA methods both use the NETWORKDAYS function to return the number of work hours between two dates by identifying the number of workdays between two dates and multiply by the number of work hours in a day.
FORMULA
=NETWORKDAYS(start_date,end_date,holidays)*hour_per_day
ARGUMENTS
start_date: The start date from which to begin counting the number of workdays.
end_date: The end date at which to stop counting the number of workdays.
hour_per_day: Working hours in a day.
holidays: A list of dates that captures the holidays to take into consideration.

RELATED TOPICS

Related Topic Description Related Topic and Description
How return the number of working days (business days) between two dates using Excel and VBA
How to return the remaining number of working days (business days) in a specific month, based on a specific date, using Excel and VBA
How to return the number of working days in a month using Excel and VBA
How to return the number of working days (business days) that have already passed in a specific month, based on a specific date, using Excel and VBA
How to return the next work day (business day) using Excel and VBA