Excel - DAYS Function



DAYS Function

The Excel DAYS function is constructed to count the number of days between two valid dates. It is categorized under Excel's Date & Time function and was first launched in Excel 2013. It is not supported in the older version of Excel. Multiple role models, such as financial analysts, project managers, and business analysts, may greatly benefit from this function by quickly determining fixed deposit duration, calculating the number of days essential to complete high-priority projects, maturity of the bonds etc.

Compatibility

This advanced Excel function is compatible with the following versions of MS-Excel −

  • Excel for Microsoft 365
  • Excel for Microsoft 365 for Mac
  • Excel for the web
  • Excel 2024
  • Excel 2024 for Mac
  • Excel 2021
  • Excel 2021 for Mac
  • Excel 2019
  • Excel 2016
  • Excel 2013

Syntax

The syntax of the DAYS function is as follows −

=DAYS(end_date, start_date)

Arguments

You can use the following arguments with the DAYS function −

Argument Description Required/ Optional
End_date It specifies a date serial number, a cell reference referring to a date value, a date in a valid format, or a formula whose result is a specific date value. Required
Start_date It specifies another date serial number, a valid date, or a cell reference that points to a Date value. Required

Points to Remember

  • If both arguments contain a text string that is not parsed as valid dates, then in this case, the DAYS function will retrieve the #VALUE! Error.
  • If both arguments contain numeric values outside the ranges of valid dates, then the DAYS function will retrieve the #NUM! error.
  • If the numeric value is supplied in both arguments, then the DAYS function subtracts the Start Date from the End Date to find the number of days in Excel
  • The Microsoft Excel tool saves dates as sequential serial numbers for further calculations. By default, serial number 1 is assigned to January 1, 1900, and serial number 39448 is assigned to January 1, 2008.
  • If any arguments contain a text string, that argument is considered DATEVALUE (date_text) and retrieves an integer date despite a time component.

Examples of DAYS Function

Practice the following examples to learn the use of the DAYS function in Excel.

Example 1: How to use the DAYS Function in Excel?

In this example, we will apply the DAYS function in the targeted cells to find the number of days between either two date serial numbers or one of the Date arguments is empty to get to know the result of this function

Solution

Step 1 − First, consider the sample dataset, which has three columns named "Start Date", "Today Date", and "Result".

How to use the DAYS Function in Excel1

Step 2 − After that, select the cell range D2:D6 and write the formula = DAYS(C2,B2) in the formula bar.

How to use the DAYS Function in Excel2

Then, press Enter to display the computed values in the selected range of cells.

How to use the DAYS Function in Excel3

Note − If the invalid date is given in the B6 cell, the DAYS function will retrieve the #VALUE! error showcased in the D6 cell.

Example 2: Calculating Days from Date to Today Utilizing the DAYS Function

In this example, we will apply an Excel formula to count days from date to today automatically.

Solution

Step 1 − In the sample dataset, we have three columns named "Start Date", "Today Date" and "Result". The Start Date column comprises various dates, and the "Today date" column has the =TODAY() formula applied in the B2:B5 range of the cells representing today's date.

Calculating Days from Date to Today Utilizing1

Step 2 − Afterward, select the range of cells C2:C5 and write the formula =DAYS(B2,A2) in the formula bar.

Calculating Days from Date to Today Utilizing2

Then, hit "Ctrl+E" to count days from date to date.

Calculating Days from Date to Today Utilizing3

As you can notice in this screenshot, the #VALUE! retrieved by the DAYS function as the given Start Date (A5 cell) is invalid.

Download Practice Sheet

You can download and use the sample data sheet to practice the DAYS function.

Advertisements