The DAYS function is a simple date function that calculates the length of time between two dates. The same result can be arrived at by subtracting two dates:
="7/31/2016"-"6/5/1991". If the start and end dates are rervsed, the function returns a negative number.
Before reading the examples below, ensure you know how dates and times work as a large part of using date functions correctly is understanding what makes up a valid date. If you do not provide a valid date, the formula will error.
The DAYS function returns the number of days between two dates.
DATEDIF – Calculate the length of time between two dates. Use this for a more flexible alternative.
MINUS – Subtract one value from another. You can use this function with dates.
NETWORKDAYS – Calculates the number of workdays between two dates.
NETWORKDAYS.INTL – Calculates the number of workdays between two dates. NETWORKDAYS.INTL can exclude holidays if you provide them. This function is a more flexible version of NETWORKDAYS.
#NUM – The inputs are numbers but are not valid dates. If you used the 35th day of November, “11/352018”, your dates would be invalid.
#VALUE! – The inputs don’t convert to a number such as “The other day” or “Yester-yester-day”.
Note that, for some reason, the function wants the ending date first, then the starting date.
Below are a few simple examples of the function being used in a spreadsheet.
|Number of days between 7/30/2016 and 7/31/2017||366|
|Number of days between 12/5/2015 and 1/7/2020||1,494|
|Number of days between 3/5/2001 (assuming that the value was in C3) and 2/9/1994||-2,581|
Live examples in Sheets
Go to this spreadsheet for examples of the DAYS function that you can study and use anywhere you would like.