Part of the free Module 5: Excel Formulas and Functions · Function 22 of 105 · Full Excel course
The Excel DAYS function returns the number of days between two dates as a whole number, with the end date listed first. It gives the same result as subtracting one date from the other, but it also accepts dates written as text and makes the intention of the formula obvious. DAYS was introduced in Excel 2013 and is available in all later versions, including Excel 365 and Excel for the web.
Syntax
=DAYS(end_date, start_date)
Arguments
| Argument | Required / Optional | Meaning |
|---|---|---|
| end_date | Required | The later date. A real date, a date-returning function or recognisable date text. |
| start_date | Required | The earlier date. If it is later than end_date, the result is negative. |
How DAYS works
DAYS converts both arguments to date serial numbers, drops any time portion, and returns end_date minus start_date. =DAYS("2026-09-04","2026-01-01") returns 246. The count is exclusive: consecutive dates return 1, so add 1 when both ends should be counted, for example for hotel nights versus calendar days. Text that cannot be read as a date returns #VALUE!, and dates outside the Excel range (1900 to 9999) return #NUM!.
Step-by-step example: days outstanding on invoices
- Enter invoice dates in column B, starting at B2.
- In C2 enter
=DAYS(TODAY(),B2)and press Enter. The result is the number of days since the invoice date. - Fill the formula down. If any cell shows a date such as 05/08/1900, change its format to General.
- In D2 enter
=IF(C2>30,"Overdue","Current")to classify each invoice.
Practical use cases
1. Days until a deadline
=DAYS(E2,TODAY())
Positive results are days remaining; negative results show how many days late.
2. Duration that ignores the order of the dates
=ABS(DAYS(A2,B2))
3. Inclusive count of calendar days
=DAYS(B2,A2)+1
Counts both the first and last day, as required for leave and rental calculations.
4. Average days to pay
=AVERAGE(DAYS(D2:D200,C2:C200))
In Excel 365 the ranges are evaluated pairwise; in older versions press Ctrl+Shift+Enter.
5. Working with text dates from an export
=DAYS("2026-12-31",A2)
The end date is typed as ISO text, which every locale reads correctly.
Common mistakes and tips
- Argument order: the end date comes first. Reversing them gives a negative number.
- #VALUE! error: one argument is text that is not a valid date, for example “31/12/2026” on a US system. Use ISO text (yyyy-mm-dd) or real date cells.
- Result shown as a date: the cell inherited a date format. Set it to General or Number.
- #NAME? error: DAYS does not exist in Excel 2010 or earlier. Use
=B2-A2instead. - Time portions: DAYS ignores times. For elapsed hours use subtraction and multiply by 24.
DAYS compared with subtraction, DATEDIF, DAYS360 and NETWORKDAYS
Plain subtraction, =B2-A2, works in every version and is what most experienced users type; DAYS adds readability and tolerance for text dates. DATEDIF is needed when the difference must be expressed in complete months or years, such as for ages. DAYS360 counts days on a 30-day-month, 360-day-year basis used in some interest calculations and gives a different answer from DAYS for most periods. NETWORKDAYS counts only working days and can exclude holidays, so it is the right choice for project durations and SLA calculations. When you simply need calendar days between two dates, DAYS or subtraction is correct and the others are unnecessary.
Related functions
- DATEDIF: difference in complete years, months or days.
- NETWORKDAYS: working days between two dates.
- DAYS360: days on a 360-day financial year.
- TODAY: supplies the current date.
- See all lessons in the Excel Formulas course.
Frequently asked questions
What is the difference between DAYS and DATEDIF?
DAYS returns only the number of days between two dates. DATEDIF can return complete years, months or days, and the remainders, which makes it suitable for ages and tenure.
Does DAYS include both the start and end dates?
No. It returns the difference, so consecutive dates give 1. Add 1 to the result for an inclusive count.
Why does DAYS return a negative number?
The start date is later than the end date. Swap the arguments, or wrap the formula in ABS if the sign does not matter.
Need a ready-made template? Browse 7,000+ Excel, Power BI and Google Sheets templates at NextGenTemplates.com.