Exceljet

Quick, clean, and to the point

Excel DAYS Function

Excel DAYS function
Summary 

The Excel DAYS function returns the number of days between two dates. With a start date in A1 and end date in B1, =DAYS(B1,A1) will return the days between the two dates.

Purpose 
Get days between dates
Return value 
A number representing days.
Syntax 
=DAYS (end_date, start_date)
Arguments 
  • end_date - The end date.
  • start_date - The start date.
Version 
Usage notes 

The DAYS function returns the number of days between two dates. Both dates must be valid Excel dates or text values that can be parsed as dates. The DAYS function only works with whole numbers, fractional time values are ignored. If start and end dates are reversed, DAYS returns a negative number. The DAYS function returns all days between two dates, to calculate working days between dates, see the NETWORKDAYS function.

Examples

With a start date in A1 and end date in A2,

=DAYS(A2,A1)

Will return the same result as:

=A2-A1

Unlike the simple formula above, the DAYS function can also handle dates in text format, as long as the date is recognized by Excel. For example:

=DAYS("7/15/2016","7/1/2016") // returns 14

The DAYS function returns the number of days between two dates. For example:

=DAYS("1-Mar-21","2-Mar-21") // returns 1

To include both the start and end date in the count, add 1 to the result:

=DAYS("1-Mar-21","2-Mar-21")+1 // returns 2

Storing and parsing text values that represent dates should be avoided, because it can introduce errors and parsing problems. Working with native Excel dates (which are numbers) is a better approach. To create a numeric date from scratch in a formula, use the DATE function.

Notes

  • The DAYS function only works with whole numbers and ignores time.
  • If dates are not recognized, DAYS returns the #VALUE! error.
  • If dates are out of range, DAYS returns the #NUM! error.

Download 100+ Important Excel Functions

Get over 100 Excel Functions you should know in one handy PDF.