Excel Days Worked Calculator
Calculate the exact number of days worked between two dates in Excel, including weekends, holidays, and custom work schedules.
Complete Guide: How to Calculate Number of Days Worked in Excel
Calculating the number of days worked in Excel is essential for payroll processing, project management, attendance tracking, and compliance reporting. This comprehensive guide covers all methods—from basic date differences to advanced workday calculations that account for weekends, holidays, and custom work schedules.
Why Calculate Days Worked in Excel?
Excel remains the gold standard for workplace calculations because of its:
- Accuracy: Handles leap years, varying month lengths, and time zones.
- Flexibility: Adapts to part-time schedules, shift work, and global holidays.
- Automation: Updates dynamically when dates change.
- Integration: Works seamlessly with payroll systems like ADP or QuickBooks.
4 Methods to Calculate Days Worked in Excel
1. Basic Date Subtraction (DAYS Function)
The simplest method subtracts the start date from the end date:
=B2-A2
Where:
A2= Start date (e.g.,2023-01-15)B2= End date (e.g.,2023-02-20)
Result: Returns the total calendar days (including weekends/holidays).
Format the result cell as General or Number to avoid date serialization (e.g., 36 instead of 1900-02-05).
2. NETWORKDAYS Function (Excludes Weekends & Holidays)
The NETWORKDAYS function excludes Saturdays, Sundays, and optional holidays:
=NETWORKDAYS(A2, B2, [holidays])
Example:
=NETWORKDAYS("2023-01-01", "2023-01-31", {"2023-01-02", "2023-01-16"})
Result: 21 (26 total days minus 4 weekends and 2 holidays).
| Scenario | Formula | Result |
|---|---|---|
| Standard workweek (Mon-Fri) | =NETWORKDAYS(A2,B2) |
Excludes Sat/Sun |
| Custom weekends (e.g., Fri-Sat) | =NETWORKDAYS.INTL(A2,B2,7) |
Excludes Fri/Sat (code 7) |
| With holidays | =NETWORKDAYS(A2,B2,D2:D10) |
Excludes Sat/Sun + dates in D2:D10 |
3. WORKDAY Function (Adds Workdays to a Date)
Calculates a future/past date by adding workdays (skipping weekends/holidays):
=WORKDAY(start_date, days, [holidays])
Example: Add 10 workdays to 2023-03-01:
=WORKDAY("2023-03-01", 10)
Result: 2023-03-15 (skips 2 weekends).
4. DATEDIF Function (Flexible Date Differences)
The DATEDIF function calculates differences in days, months, or years:
=DATEDIF(start_date, end_date, unit)
| Unit | Description | Example |
|---|---|---|
"d" |
Days between dates | =DATEDIF(A2,B2,"d") → 45 |
"m" |
Complete months between dates | =DATEDIF(A2,B2,"m") → 1 |
"y" |
Complete years between dates | =DATEDIF(A2,B2,"y") → 0 |
"ym" |
Months excluding years | =DATEDIF(A2,B2,"ym") → 3 |
Handling Custom Work Schedules
For non-standard workweeks (e.g., 4-day workweeks or retail schedules), use NETWORKDAYS.INTL:
=NETWORKDAYS.INTL(start_date, end_date, [weekend], [holidays])
Weekend Codes:
1= Sat-Sun (default)2= Sun-Mon11= Sun only12= Mon-Tue17= Sat only
Example: Calculate workdays for a Sun-Thu workweek (common in Middle East):
=NETWORKDAYS.INTL(A2, B2, 2, D2:D10)
Advanced: Dynamic Holiday Lists
For recurring holidays (e.g., “4th Thursday in November” for Thanksgiving), combine functions:
- List holidays in a table: Create a named range (e.g.,
Holidays) with dates. - Use
WORKDAYwith dynamic dates:=WORKDAY(A2, 10, Holidays)
- Auto-update holidays yearly: Use
=DATE(YEAR(TODAY()), 11, 1)+WEEKDAYlogic.
According to the U.S. Bureau of Labor Statistics (BLS), 78% of full-time employees work a standard Monday-Friday schedule, but 12% work alternative shifts (e.g., 4×10 or 3×12). Always verify your organization’s workweek definition before running calculations.
Common Errors and Fixes
Cause: Non-date values in cells.
Fix: Use =ISNUMBER(A2) to validate dates.
Cause: Start date > end date.
Fix: Use =IF(A2>B2, "Invalid", NETWORKDAYS(A2,B2)).
Cause: Time components in dates.
Fix: Use =INT(A2) to strip time.
Real-World Applications
1. Payroll Processing
Calculate:
- Overtime eligibility (e.g., >40 hours/week in the U.S.).
- PTO accrual (e.g., 1 day per 30 days worked).
- Bonus proration (e.g.,
=DATEDIF(hire_date, today, "d")/365*bonus).
2. Project Management
Use WORKDAY to:
- Set deadlines:
=WORKDAY(TODAY(), 14)(2 weeks from now). - Track sprints:
=NETWORKDAYS(start_date, end_date)/7(weeks).
3. Compliance Reporting
For FLSA compliance (U.S. Department of Labor), track:
- Consecutive workdays (>6 may require rest periods in some states).
- Average hours per day:
=total_hours/NETWORKDAYS(start,end).
Excel vs. Google Sheets
| Feature | Excel | Google Sheets |
|---|---|---|
| NETWORKDAYS | Yes (since 2007) | Yes |
| NETWORKDAYS.INTL | Yes (2010+) | Yes |
| Dynamic Arrays | Yes (365/2021) | Limited |
| Holiday Range Limit | Unlimited | ~50 dates |
| Offline Use | Yes | No (requires internet) |
Automating with VBA (Advanced)
For repetitive tasks, use VBA to:
- Auto-populate holidays from a web API.
- Generate reports for multiple employees.
- Validate date ranges.
Example VBA Function:
Function CustomWorkdays(start_date, end_date, Optional weekends As Variant, Optional holidays As Range)
' Calculate workdays with custom weekends
Dim days As Long
days = 0
Dim current_date As Date
current_date = start_date
Do While current_date <= end_date
' Check if current_date is a weekend
Dim is_weekend As Boolean
is_weekend = False
' Add logic to check weekends array
' ...
' Check if current_date is a holiday
Dim is_holiday As Boolean
is_holiday = False
If Not holidays Is Nothing Then
' Loop through holidays range
End If
If Not is_weekend And Not is_holiday Then
days = days + 1
End If
current_date = current_date + 1
Loop
CustomWorkdays = days
End Function
Best Practices
- Always validate dates: Use
=ISNUMBERand=ISERROR. - Document assumptions: Note which days are considered "workdays" in a cell comment.
- Use named ranges: Replace
D2:D10withHolidays_2024for clarity. - Test edge cases: Leap years (e.g., 2024-02-29), year-end rollovers.
- Protect formulas: Lock cells with
=PROTECTto prevent accidental edits.
Frequently Asked Questions
How do I calculate partial days (e.g., 4-hour shifts)?
Multiply the day count by the daily fraction:
=NETWORKDAYS(A2,B2) * (shift_hours / 8)
Can I calculate days worked across multiple years?
Yes! Excel handles date serialization automatically. For yearly breakdowns:
=DATEDIF(A2, B2, "y") & " years, " & DATEDIF(A2, B2, "ym") & " months"
How do I exclude company-specific holidays?
Create a named range (e.g., CompanyHolidays) and reference it:
=NETWORKDAYS(A2, B2, CompanyHolidays)
What’s the fastest way to apply this to 100+ employees?
Use a spill range (Excel 365/2021):
=BYROW(EmployeeRanges, LAMBDA(r, NETWORKDAYS(INDEX(r,1), INDEX(r,2))))
For complex scenarios, refer to the official Microsoft Excel documentation or consult a tax professional for payroll-specific questions.