MS Excel: How to use the DAYS Function (WS)
This Excel tutorial explains how to use the Excel DAYS function with syntax and examples.
Description
The Microsoft Excel DAYS function returns the number of days between two date values.
The DAYS function is a built-in function in Excel that is categorized as a Date/Time Function. It can be used as a worksheet function (WS) in Excel. As a worksheet function, the DAYS function can be entered as part of a formula in a cell of a worksheet.
The DAYS function was first introduced in Excel 2013. If you are running an older version of Excel that does not support the DAYS function, try using the DATEDIF function instead.
If you want to follow along with this tutorial, download the example spreadsheet.
Syntax
The syntax for the DAYS function in Microsoft Excel is:
DAYS( end_date, start_date )
Parameters or Arguments
- end_date and start_date
- The two dates to calculate the number of days between.
Returns
The DAYS function returns a numeric value.
Applies To
- Excel for Office 365, Excel 2019, Excel 2016, Excel 2013
Type of Function
- Worksheet function (WS)
Example (as Worksheet Function)
Let's look at some Excel DAYS function examples and explore how to use the DAYS function as a worksheet function in Microsoft Excel:
Based on the Excel spreadsheet above, the following DAYS examples would return:
=DAYS(B2,A2) Result: 1 =DAYS(B3,A3) Result: 30 =DAYS(B4,A4) Result: 92 =DAYS(B5,A5) Result: 365 =DAYS(B6,A6) Result: -365 =DAYS("1/27/2016","1/26/2016") Result: 1
Always Return the Number of Days as a Positive Value
If you are not sure which order to enter your dates in the DAYS function, you sometimes getting a negative value.
For example:
=DAYS("1/26/2016","1/31/2016") Result: -5
Try using the ABS function to return your result as an absolute value:
=ABS(DAYS("1/26/2016","1/31/2016")) Result: 5
Now the result will always be a positive number regardless of which order the dates are entered as parameters in the DAYS function.
Advertisements