Excel Days Calculator
Calculate the number of days between two dates in Excel with different methods. Get instant results and visualizations.
Comprehensive Guide: How to Calculate Number of Days in Excel
Calculating the number of days between dates is one of the most common tasks in Excel, whether you’re tracking project timelines, calculating employee tenure, or analyzing financial periods. This expert guide covers all methods to calculate days in Excel, from basic to advanced techniques.
1. Basic Days Calculation (Simple Subtraction)
The simplest way to calculate days between two dates is by subtracting the start date from the end date. Excel stores dates as serial numbers (with January 1, 1900 as day 1), so subtraction gives you the exact number of days.
Example: =B2-A2
Key Points:
- Returns the total number of days including weekends and holidays
- Result is a number that can be formatted as “General” or “Number”
- Works in all versions of Excel (2007 and later)
2. Calculating Workdays (Excluding Weekends)
For business calculations where you need to exclude weekends (Saturday and Sunday), use the NETWORKDAYS function:
Example: =NETWORKDAYS(A2, B2)
Advanced Usage:
To also exclude specific holidays, add a range containing holiday dates as the third argument:
Where D2:D10 contains your list of holiday dates.
3. Calculating Days Excluding Both Weekends and Holidays
For complete business day calculations that exclude both weekends and company holidays:
The “-1” adjustment accounts for the fact that NETWORKDAYS counts both the start and end dates as full days if they’re workdays.
4. Calculating Days Between Dates in Different Years
When working with dates spanning multiple years, you might want to break down the calculation:
Note: DATEDIF is a legacy function but remains one of the most powerful for complex date calculations.
5. Handling Time Components in Date Calculations
When your dates include time values, use INT to get whole days:
To get the remaining time after whole days:
6. Calculating Days Until Today
For dynamic calculations that always show days until the current date:
Or for workdays until today:
Excel Version Comparisons for Date Functions
The availability and behavior of date functions can vary slightly between Excel versions. Here’s a comparison of key date functions across versions:
| Function | Excel 2016 | Excel 2019 | Excel 2021/365 | Excel Online |
|---|---|---|---|---|
| DATEDIF | ✓ (undocumented) | ✓ (undocumented) | ✓ (undocumented) | ✓ (undocumented) |
| NETWORKDAYS | ✓ | ✓ | ✓ | ✓ |
| NETWORKDAYS.INTL | ✓ | ✓ | ✓ | ✓ |
| DAYS | ✓ | ✓ | ✓ | ✓ |
| DAYS360 | ✓ | ✓ | ✓ | ✓ |
| YEARFRAC | ✓ | ✓ | ✓ | ✓ |
| EDATE | ✓ | ✓ | ✓ | ✓ |
| EOMONTH | ✓ | ✓ | ✓ | ✓ |
Common Errors and Solutions
Even experienced Excel users encounter issues with date calculations. Here are the most common problems and their solutions:
-
#VALUE! Error
Cause: One or both date arguments aren’t recognized as valid dates.
Solution: Ensure cells are formatted as dates (Format Cells > Date) or use the DATE function to create proper dates.
-
Negative Numbers
Cause: Start date is after the end date.
Solution: Use ABS function to get absolute value: =ABS(End_Date – Start_Date)
-
Incorrect Holiday Exclusion
Cause: Holiday range in NETWORKDAYS contains non-date values.
Solution: Verify all cells in holiday range are proper dates.
-
Leap Year Issues
Cause: February 29 in non-leap years causing errors.
Solution: Use DATE function to validate dates: =DATE(YEAR,2,29) will auto-correct to March 1 in non-leap years.
-
Time Zone Problems
Cause: Dates entered with time zones causing unexpected results.
Solution: Use INT function to remove time components: =INT(End_Date) – INT(Start_Date)
Advanced Techniques for Date Calculations
1. Calculating Business Hours Between Dates
For precise business hour calculations (e.g., 9 AM to 5 PM):
Where A2 = start date/time, B2 = end date/time, and you’ve defined named ranges for Start_Time (9:00) and End_Time (17:00).
2. Creating a Dynamic Date Counter
For a counter that updates automatically:
Combine with conditional formatting to highlight when dates are approaching.
3. Calculating Age in Years, Months, and Days
For precise age calculations:
4. Working with Fiscal Years
For organizations with non-calendar fiscal years (e.g., July-June):
Best Practices for Date Calculations in Excel
-
Always Validate Dates
Use ISNUMBER with DATEVALUE to check if entries are valid dates:
=IF(ISNUMBER(DATEVALUE(A2)), “Valid”, “Invalid”) -
Use Named Ranges for Holidays
Create a named range for your holiday list to make formulas more readable and maintainable.
-
Document Your Formulas
Add comments to complex date calculations to explain their purpose.
-
Test with Edge Cases
Always test with:
- Same start and end dates
- Dates spanning year boundaries
- Leap day (February 29)
- Dates with time components
-
Consider Time Zones for Global Workbooks
For international workbooks, either:
- Standardize on UTC
- Add time zone conversion columns
- Use the =NOW() function with time zone adjustments
Excel Date Functions Reference
| Function | Purpose | Syntax | Example |
|---|---|---|---|
| TODAY | Returns current date | =TODAY() | =TODAY() |
| NOW | Returns current date and time | =NOW() | =NOW() |
| DATE | Creates date from year, month, day | =DATE(year,month,day) | =DATE(2023,12,25) |
| YEAR | Returns year from date | =YEAR(date) | =YEAR(A2) |
| MONTH | Returns month from date | =MONTH(date) | =MONTH(A2) |
| DAY | Returns day from date | =DAY(date) | =DAY(A2) |
| DATEDIF | Calculates difference between dates | =DATEDIF(start,end,unit) | =DATEDIF(A2,B2,”d”) |
| NETWORKDAYS | Workdays between dates | =NETWORKDAYS(start,end,[holidays]) | =NETWORKDAYS(A2,B2) |
| WORKDAY | Returns workday before/after date | =WORKDAY(start,days,[holidays]) | =WORKDAY(A2,10) |
| EDATE | Returns date n months before/after | =EDATE(start,months) | =EDATE(A2,3) |
| EOMONTH | Returns last day of month | =EOMONTH(start,months) | =EOMONTH(A2,0) |
| WEEKDAY | Returns day of week | =WEEKDAY(date,[return_type]) | =WEEKDAY(A2,2) |
| WEEKNUM | Returns week number | =WEEKNUM(date,[return_type]) | =WEEKNUM(A2,21) |
| DAYS | Days between dates | =DAYS(end,start) | =DAYS(B2,A2) |
| DAYS360 | Days between dates (360-day year) | =DAYS360(start,end,[method]) | =DAYS360(A2,B2) |
| YEARFRAC | Fraction of year between dates | =YEARFRAC(start,end,[basis]) | =YEARFRAC(A2,B2,1) |
External Resources and Further Learning
For official documentation and advanced techniques, consult these authoritative sources:
- Microsoft Office Support: Date and Time Functions – Official documentation from Microsoft
- Exceljet: Date Functions – Comprehensive guide with practical examples
- Corporate Finance Institute: Excel Dates Guide – Financial applications of date functions
- NIST Time and Frequency Division – Official time standards that influence Excel’s date system
Frequently Asked Questions
Why does Excel show ###### instead of my date?
This typically means the column isn’t wide enough to display the date format. Either widen the column or change to a shorter date format (like “mm/dd/yyyy” instead of “Monday, January 01, 2023”).
How does Excel store dates internally?
Excel for Windows uses a date system where January 1, 1900 is day 1 (though it incorrectly assumes 1900 was a leap year). Excel for Mac originally used January 1, 1904 as day 0, but modern versions default to the 1900 system for compatibility.
Can I calculate days excluding specific weekdays (like Fridays)?
Yes, use NETWORKDAYS.INTL with a custom weekend parameter:
Where “11” represents Saturday and Sunday as weekends (1=Saturday, 1=Sunday in binary). For different combinations, use different numbers (e.g., 13 for Sunday and Monday).
Why do I get different results between Excel and other programs?
Differences usually stem from:
- Different date systems (1900 vs 1904 origin)
- Time zone handling
- Leap year calculations (Excel considers 1900 a leap year incorrectly)
- Different day count conventions (30/360 vs actual/actual)
How can I calculate the number of months between dates?
Use DATEDIF with “m” unit:
For complete months (ignoring partial months):