Excel Days Between Dates Calculator
Calculate the exact number of days between two dates with Excel formulas – including today’s date
Comprehensive Guide: How to Calculate Days Between Dates in Excel (Including Today)
Calculating the number of days between two dates is one of the most common tasks in Excel, whether you’re tracking project timelines, calculating age, determining contract durations, or analyzing time-based data. This comprehensive guide will walk you through all the methods to calculate days between dates in Excel, including special considerations for including today’s date in your calculations.
Why Calculating Days Between Dates Matters
Understanding date calculations in Excel is crucial for:
- Project management and timeline tracking
- Financial calculations (interest, payment periods)
- HR functions (employee tenure, vacation accrual)
- Data analysis with time-series data
- Contract and warranty period calculations
- Age calculations in various applications
Basic Methods to Calculate Days Between Dates
Method 1: Simple Subtraction
The most straightforward way to calculate days between two dates is by simple subtraction. Excel stores dates as serial numbers (with January 1, 1900 as day 1), so subtracting one date from another gives you the number of days between them.
Formula: =End_Date - Start_Date
Example: =B2-A2 (where B2 contains the end date and A2 contains the start date)
Method 2: Using the DATEDIF Function
The DATEDIF function is specifically designed for date calculations and offers more flexibility than simple subtraction.
Syntax: =DATEDIF(start_date, end_date, unit)
Units:
"d"– Days"m"– Months"y"– Years"ym"– Months excluding years"yd"– Days excluding years"md"– Days excluding months and years
Example: =DATEDIF(A2,B2,"d")
Method 3: Using the DAYS Function (Excel 2013 and later)
The DAYS function is a newer addition that provides a simple way to calculate days between dates.
Syntax: =DAYS(end_date, start_date)
Example: =DAYS(B2,A2)
Including Today’s Date in Your Calculations
When you need to calculate days between a past date and today, or between today and a future date, you’ll need to use Excel’s TODAY function.
Using TODAY with Simple Subtraction
Formula: =TODAY() - Start_Date (for days from past to today)
Formula: =End_Date - TODAY() (for days from today to future)
Using TODAY with DATEDIF
Formula: =DATEDIF(Start_Date, TODAY(), "d")
Important Notes About TODAY()
- The TODAY function is volatile – it recalculates every time the worksheet opens or changes
- It returns the current date based on your system clock
- It doesn’t take time into account, only the date
- If you need a static “today” date, consider using
Ctrl+;to insert the current date as a value
Advanced Date Calculations
Calculating Workdays (Excluding Weekends)
Use the NETWORKDAYS function to calculate business days between dates:
Syntax: =NETWORKDAYS(start_date, end_date, [holidays])
Example: =NETWORKDAYS(A2,B2)
Calculating Workdays with Holidays
You can exclude specific holidays by referencing a range containing holiday dates:
Example: =NETWORKDAYS(A2,B2,D2:D10) (where D2:D10 contains holiday dates)
Calculating Years, Months, and Days Separately
For more detailed breakdowns:
- Years:
=DATEDIF(A2,B2,"y") - Months:
=DATEDIF(A2,B2,"ym") - Days:
=DATEDIF(A2,B2,"md")
Common Errors and Troubleshooting
#VALUE! Error
This typically occurs when:
- One or both dates are not valid Excel dates
- Cells contain text instead of dates
- Dates are entered as text that Excel can’t recognize as dates
Solution: Ensure both cells contain valid dates. You can check by changing the cell format to General – if it shows as a number, it’s a valid date.
Negative Numbers
Negative results indicate that your end date is earlier than your start date.
Solution: Swap the dates or use the ABS function: =ABS(End_Date - Start_Date)
Incorrect Results Due to Date Formats
Excel might misinterpret dates if your system uses different date settings than your data.
Solution: Use the DATE function to create unambiguous dates: =DATE(year,month,day)
Performance Considerations
When working with large datasets:
- Volatile functions like TODAY() can slow down your workbook
- Consider using static dates where possible
- For very large datasets, helper columns might improve performance
- The DAYS function is generally faster than DATEDIF for simple day calculations
Real-World Applications
Project Management
Calculate:
- Project duration
- Time remaining until deadline
- Milestone tracking
- Resource allocation periods
Human Resources
Track:
- Employee tenure
- Vacation accrual periods
- Probation periods
- Time between reviews
Financial Analysis
Calculate:
- Investment periods
- Loan durations
- Payment schedules
- Time-weighted returns
Comparison of Date Calculation Methods
| Method | Syntax | Pros | Cons | Best For |
|---|---|---|---|---|
| Simple Subtraction | =end_date – start_date | Simple, fast, works in all Excel versions | No formatting options, basic functionality | Quick calculations, large datasets |
| DATEDIF | =DATEDIF(start,end,unit) | Flexible units, precise calculations | Not well documented, inconsistent in some versions | Complex date calculations, breaking down into years/months/days |
| DAYS | =DAYS(end_date,start_date) | Simple, clear syntax, fast | Only calculates days, requires Excel 2013+ | Modern workbooks, simple day calculations |
| NETWORKDAYS | =NETWORKDAYS(start,end,[holidays]) | Handles business days, excludes weekends/holidays | More complex syntax, requires holiday list | Business applications, project timelines |
Excel Version Compatibility
| Function | Excel 2013 | Excel 2016 | Excel 2019 | Excel 365 | Notes |
|---|---|---|---|---|---|
| Simple Subtraction | ✓ | ✓ | ✓ | ✓ | Works in all versions |
| DATEDIF | ✓ | ✓ | ✓ | ✓ | Undocumented but available in all versions |
| DAYS | ✓ | ✓ | ✓ | ✓ | Introduced in Excel 2013 |
| NETWORKDAYS | ✓ | ✓ | ✓ | ✓ | Available in all modern versions |
| NETWORKDAYS.INTL | ✓ | ✓ | ✓ | ✓ | More flexible weekend parameters |
| TODAY | ✓ | ✓ | ✓ | ✓ | Works in all versions but is volatile |
Best Practices for Date Calculations in Excel
- Always use proper date formats: Ensure your dates are recognized as dates by Excel (right-aligned in cells by default)
- Use the DATE function for clarity:
=DATE(2023,12,25)is unambiguous - Document your formulas: Add comments to explain complex date calculations
- Consider time zones: If working with international dates, be aware of time zone differences
- Use helper columns: For complex calculations, break them down into steps
- Test edge cases: Check how your formulas handle leap years, month-end dates, etc.
- Be mindful of volatile functions: Functions like TODAY() recalculate frequently and can slow down large workbooks
- Use named ranges: For frequently used date ranges (like holiday lists)
- Validate your data: Use Data Validation to ensure only valid dates are entered
- Consider Excel’s date limits: Excel can handle dates from 1/1/1900 to 12/31/9999
Alternative Approaches
Power Query
For large datasets or complex date transformations, Power Query can be more efficient than worksheet formulas.
VBA Macros
For repetitive or highly complex date calculations, VBA macros can automate the process.
Pivot Tables
When analyzing date ranges across large datasets, Pivot Tables with date grouping can be powerful.
Learning Resources
To deepen your understanding of Excel date functions:
- Microsoft’s official Excel support – Comprehensive documentation on all date functions
- GCFGlobal Excel Tutorials – Free interactive lessons on Excel functions
- Excel Easy – Practical examples and explanations of Excel functions
Frequently Asked Questions
Why does Excel show ###### instead of my date?
This typically happens when:
- The column isn’t wide enough to display the full date
- The cell contains a negative date (before 1/1/1900)
- The cell format is incorrect for the date value
Solution: Widen the column or check the cell format (should be Date).
How do I calculate someone’s age in Excel?
Use this formula:
=DATEDIF(birth_date, TODAY(), "y")
For more precision:
=DATEDIF(birth_date, TODAY(), "y") & " years, " & DATEDIF(birth_date, TODAY(), "ym") & " months, " & DATEDIF(birth_date, TODAY(), "md") & " days"
Can I calculate the number of weeks between dates?
Yes, divide the day difference by 7:
=ROUNDDOWN((end_date-start_date)/7,0) for whole weeks
Or for decimal weeks:
=(end_date-start_date)/7
How do I handle dates before 1900 in Excel?
Excel’s date system starts at 1/1/1900. For earlier dates:
- Store them as text
- Use a custom date system (more advanced)
- Consider using a database system instead of Excel
Why does DATEDIF sometimes give different results than simple subtraction?
DATEDIF counts complete intervals. For example:
- From 1/31/2023 to 2/1/2023 is 1 day difference with subtraction
- But DATEDIF with “m” unit would return 1 month (even though it’s only 1 day)
Choose the method that matches your specific requirement.
Conclusion
Mastering date calculations in Excel – particularly calculating days between dates including today – is an essential skill for anyone working with time-based data. Whether you’re using simple subtraction, the versatile DATEDIF function, or the modern DAYS function, understanding these techniques will make you more efficient and accurate in your Excel work.
Remember that the best method depends on your specific needs:
- For simple day counts, use subtraction or DAYS
- For breaking down into years/months/days, use DATEDIF
- For business days, use NETWORKDAYS
- For dynamic “today” calculations, use TODAY()
As you become more comfortable with these functions, you’ll find countless applications in business, finance, project management, and data analysis. The key is to practice with real-world scenarios and understand how Excel handles dates as serial numbers behind the scenes.