Excel Calculate Net Work Hours Between Two Dates
To calculate net work hours between two dates in Excel while excluding weekends, use the NETWORKDAYS function combined with a time calculation. The core formula is NETWORKDAYS(start_date, end_date) - 1 to get the number of full workdays, then multiply by daily work hours and adjust for start and end times. This article explains the exact formula, how to customize it for your schedule, and common pitfalls to avoid.
Formula
The standard formula for net work hours between two dates (assuming a Monday–Friday workweek, 9:00 AM to 5:00 PM, i.e., 8 hours per day) is:
=(NETWORKDAYS(start_date, end_date) - 1) * (end_time - start_time) + IF(NETWORKDAYS(end_date, end_date), MEDIAN(MOD(end_date,1), end_time, start_time) - MEDIAN(MOD(start_date,1), end_time, start_time), 0)
Where:
start_dateandend_dateare the full date-time values (e.g.,2025-03-03 09:00).start_timeis the workday start time as a decimal (e.g., 9:00 AM = 0.375).end_timeis the workday end time as a decimal (e.g., 5:00 PM = 0.70833).
In Excel, dates are stored as serial numbers (1 = 1900-01-01) and times as fractions of a day. So 9:00 AM is 9/24 = 0.375, and 5:00 PM is 17/24 ≈ 0.70833.
The formula calculates the number of full workdays between the two dates (excluding the start and end days) times the daily hours, then adds the hours worked on the start and end days (if they are workdays) using the MEDIAN function to clip the times to the work window.
Worked Example
Suppose you start work on Monday, March 3, 2025 at 9:00 AM and finish on Wednesday, March 5, 2025 at 5:00 PM. The workday is 9 AM–5 PM (8 hours).
- NETWORKDAYS(start, end) = 3 (Mon, Tue, Wed).
- NETWORKDAYS – 1 = 2 full days (Mon and Tue).
- 2 days × 8 hours = 16 hours.
- Start day (Mon) hours: from 9 AM to 5 PM = 8 hours.
- End day (Wed) hours: from 9 AM to 5 PM = 8 hours.
- Total = 16 + 8 + 8 = 32 hours.
But wait—the start and end days are the same as the full days in this case. Actually, the formula subtracts 1 from NETWORKDAYS to avoid double-counting the start day. Let’s recalculate correctly:
NETWORKDAYS = 3. Subtract 1 = 2 full days (Tue and Wed? No, actually the days between start and end, excluding both) – hmm, let’s clarify.
The formula NETWORKDAYS(start, end) - 1 gives the number of full 24-hour workdays between the two dates, not counting the start day. Then we add the hours from the start day and the end day separately.
For our example:
- Full days between = NETWORKDAYS(start, end) – 1 = 3 – 1 = 2 days (these are the days after start and before end, i.e., Tue only? Actually, if start is Mon and end is Wed, NETWORKDAYS counts Mon, Tue, Wed = 3. Subtract 1 = 2. That gives us Mon and Tue as full days? No, it gives the number of days that are fully within the period, excluding the start day? Let’s test with a concrete calculation.
Actually, the correct interpretation: The formula (NETWORKDAYS(start, end) - 1) * (end_time - start_time) counts the number of complete workdays between the two dates, not counting the start day. For start Mon, end Wed, that’s 2 complete days (Tue and Wed? No, because Wed is the end day, so it’s not complete). Let’s just compute directly:
Using the formula in Excel with start = 2025-03-03 09:00, end = 2025-03-05 17:00, start_time=0.375, end_time=0.70833:
NETWORKDAYS(start, end) = 3. Subtract 1 = 2. Multiply by (0.70833-0.375)=0.33333, gives 0.66667 days = 16 hours.
Then add the start day part: IF(NETWORKDAYS(end,end), MEDIAN(MOD(end,1), end_time, start_time) - MEDIAN(MOD(start,1), end_time, start_time), 0). Here MOD(start,1)=0.375, MOD(end,1)=0.70833. MEDIAN(0.70833,0.70833,0.375)=0.70833, MEDIAN(0.375,0.70833,0.375)=0.375. Difference = 0.33333 days = 8 hours. Same for end day: 8 hours. Total = 16 + 8 + 8 = 32 hours.
So the net work hours are 32 hours.
How to Use the Formula in Excel
To apply this in your sheet:
- Enter your start date and time in one cell (e.g., A1) and end date and time in another (B1).
- Define your work start and end times as decimal values in separate cells (e.g., C1 = 9/24, D1 = 17/24).
- In a new cell, enter the formula above, replacing the cell references.
- Format the result as [h]:mm to show hours and minutes.
If you want to exclude holidays, add a range of holiday dates as the third argument to NETWORKDAYS: NETWORKDAYS(start, end, holidays).
Common Mistakes and How to Avoid Them
- Not using NETWORKDAYS – Many people try to subtract weekends manually, which is error-prone. NETWORKDAYS handles the weekend logic automatically.
- Mixing dates and times – Ensure your start and end cells contain both date and time. If you only have dates, the formula will treat the time as 00:00, giving incorrect results.
- Using 24-hour time incorrectly – Excel stores times as fractions of a day. 5:00 PM is 17/24, not 5/24. Always convert hours to decimals.
- Forgetting to handle start/end on weekends – The formula uses MEDIAN to clip times, but if start or end falls on a weekend, NETWORKDAYS still counts it as a workday? Actually, NETWORKDAYS excludes weekends, so if start is Saturday, NETWORKDAYS will not count it. But the MEDIAN part might still add hours. To avoid this, wrap the start/end day parts in an IF that checks if the day is a workday.
Alternatives and Variations
If your workweek is not Monday–Friday, you can use NETWORKDAYS.INTL which lets you specify which days are weekends. For example, to have Sunday as the only weekend, use weekend number 11 or a string like “0000001”.
If you need to account for lunch breaks, subtract the break duration from the daily hours. For instance, if the workday is 9–5 with a 1-hour lunch, use 7 hours per day instead of 8.
For a simpler approach, you can use the NETWORKDAYS function to get the number of workdays and then multiply by the daily hours, but that ignores the start/end times. The full formula above is more accurate.
Frequently Asked Questions
How do I exclude holidays from the calculation?
Add a range of holiday dates to the NETWORKDAYS function as the third argument. For example, NETWORKDAYS(A1, B1, H1:H10) where H1:H10 contains holiday dates. The formula will exclude those days from the count.
What if my workday starts at 8:30 AM and ends at 5:30 PM?
Change the start_time and end_time values in the formula. 8:30 AM is 8.5/24 = 0.35417, and 5:30 PM is 17.5/24 = 0.72917. Update the constants in the formula accordingly.
Can I calculate work hours for a part-time schedule?
Yes. Adjust the daily hours in the formula. For example, if you work 4 hours a day, use 4/24 as the daily duration, or modify the start and end times to reflect your schedule.
Why does my formula return a negative number?
This happens if the end time is earlier than the start time on the same day, or if the end date is before the start date. Ensure your dates are in the correct order and that times are within the work window.
Does the formula handle overnight shifts?
No. The formula assumes the workday is within a single day. For overnight shifts, you would need a more complex formula that splits the shift across days.
Is there a simpler way to get work hours without a formula?
You can use Excel’s built-in NETWORKDAYS function to get the number of workdays, then multiply by daily hours. But that won’t account for partial start/end days. For a quick estimate, that may be sufficient.
Related
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.