DAYS
Returns the number of days between two dates.
=DAYS(end_date, start_date)This static page keeps the function indexed for search, while the spreadsheet app handles interactive exploration and saved formulas.
What the function does
Overview
Returns the number of days between two dates.
The DAYS function calculates the total number of days between two specific dates. It operates by subtracting the ate from the ate, where both arguments can be cell references, serial numbers, or text strings that Excel recognizes as dates. Unlike simple subtraction, this function is part of the modern Excel date toolset designed for better readability in complex financial and project management models. A significant technical benefit is that it internally parses text-formatted dates, reducing the need for DATEVALUE nesting. Best practices include using cell references containing validated date values to avoid locale-specific parsing errors. If the ate is chronologically earlier than the ate, the result will be a negative integer, which is useful for tracking overdue tasks or elapsed time relative to a deadline. It correctly accounts for leap years and various month lengths by utilizing Excel's underlying serial number system, which starts from the epoch of January 1, 1900.
Quick reference
Syntax
=DAYS(end_date, start_date)
Inputs
Arguments
Example: B2
Example: A2
Formula patterns
Examples
Calculate total project duration
=DAYS(B2, A2)Determine days remaining until a deadline
=DAYS(A2, TODAY())Elapsed days since last record update
=DAYS(TODAY(), C2)Avoid these issues
Common Errors
#VALUE!
Cause: One or both arguments are text strings that cannot be recognized as valid dates or contain non-numeric characters.
Fix: Ensure dates are formatted as proper date serial numbers or use the DATE function to construct the arguments.
#NUM!
Cause: The resulting date or input dates fall outside the supported Excel date range (pre-1900 or post-9999).
Fix: Check that the years in A2 or B2 are four digits and fall within the 1900-9999 range.
Platform support
Compatibility
Source: Microsoft Support
Common questions
Frequently Asked Questions
Returns the number of days between two dates.
ate: The later date ate: The earlier date
#VALUE!: Ensure dates are formatted as proper date serial numbers or use the DATE function to construct the arguments. #NUM!: Check that the years in A2 or B2 are four digits and fall within the 1900-9999 range.