DAYS function

DAYS() function

Star InactiveStar InactiveStar InactiveStar InactiveStar Inactive
 

Return the number of days between two dates

=DAYS(end_date,start_date)


Return the number of days between two dates stored either as serial numbers (e.g. 44599 = 7th February, 2022), text values (e.g. "7-Feb-2022") or cell refences (e.g. C3).

DAYS syntax requires an end_date and a start_date. If the end date is earlier than the start date, the result is negative.


DAYS with numbers.

In the examples below, the DAYS function is used to calculate the number of days between two dates using serial numbers and cell references.

Use the DAYS function to return the number of days between two dates.

Use the DAYS function to return the number of days between two dates.

DAYS with text.

In the examples below, the DAYS function is used to calculate the number of days between two dates written as text strings.

Use the DAYS function to return the number of days between two dates.

Use the DAYS function to return the number of days between two dates.

Syntax

DAYS(end_date,start_date)

The DAYS function requires 2 arguments:

  1. end_date. Required. The end_date to which to calculate the number of days.
  2. start_date. Required. The start_date from which to calculate the number of days.

Try it now!

  • Enter your formulas into the grey cells.

Scope

DAYS can calculate the number of days between 2 numeric or textual dates.

  • Number:
 =DAYS(44599,44562) || result is 37 days where 44599 = 7-Feb-2022 and 44562 = 1-Jan-2022.
  • Text:
 =DAYS("7-Feb-2022","1-Jan-2022") || result is 37 days
  • Cell References:
 =DAYS(C7,C8) || result is 37 days where cell C7 contains the date 7-Feb-2022 and cell C8 the date 1-Jan-2022.

Caveats

  • If both date arguments are numbers: DAYS uses end_date – start_date to calculate the number of days in between both dates.
  • If either one of the date arguments is text: text argument is treated as DATEVALUE(date_text) and returns an integer date instead of a time component.
  • If date arguments are numeric values that fall outside the range of valid dates: DAYS returns the #NUM! error.
  • If date arguments are strings that cannot be parsed as valid dates: DAYS returns the #VALUE! error.
  • Only full days are counted. Fractional time values are ignored.
  • Dates should ideally be entered using the DATE function. Working with textual dates is more complicated and may necessitate extracting year, month and day components from a text string using for example LEFT, RIGHT and MID functions.

Related Functions


Functions Category

 


Register (for free!) or Login to access bonus materials

About xlsnippets

Learn how to master functions, charts, pivot tables and more using Excel for Microsoft Office 365. Simple instructions and embedded spreadsheets help you practise the basics.

Latest Updates

26 March 2022
26 March 2022
26 March 2022
25 March 2022
22 March 2022

Coming soon

xlsnippets.com is currently in beta version. More functions and bonus content for registered users will be added weekly. Detailed training courses with additional downloadable resources are also on the horizon!