Example 1 – Using Excel DAYS Function to Get Estimated Time
To estimate the total number of days needed to complete the project Steamy Ray from its Start Date and End Date in the sample dataset,
- Enter the following formula in cell E5.
=DAYS(D5,C5)
Cell D5 has the end date and C5 has the start date.
- Press Enter.
- The DAYS function will return the number of days between the two dates.
- Drag the Fill Handle icon to fill the other cells with the formula.
Example 2 – Combine DAYS & ABS Functions to Find Project Completion Date
When counting total days between two days, the DAYS function may return a negative value if you place the earlier date as end_date and the later date as start_date.
To illustrate,
- Enter the following formula.
=DAYS(C5,D5)
Cell C5 has the Start Date but, in the formula, we put the start date as end_date and D5 has the End Date but in the formula, we put it as start_date.
- Press Enter.
- Drag the Fill Handle icon to fill the other cells with the formula.
- The DAYS function will return the negative number of days between the two dates.
To avoid negative values, use the ABS function with the DAYS function.
- Enter the following formula.
=ABS(DAYS(C5,D5))
Cell C5 has the Start Date but, in the formula, put the start date as end_date and D5 has the End Date but, in the formula, put it as start_date. Using the ABS function to return the absolute value while ignoring the negative sign.
- Press Enter.
- The DAYS function will return the project completion date.
- Drag the Fill Handle icon to fill the other cells with the formula.
Example 3 – Use of DAYS Function to Handle Date Formatted as Text
In the sample dataset below, we’ve formatted the dates as text.
- Enter the following formula.
=DAYS(D5,C5)
Cell D5 has the end date and C5 has the start date.
- Press Enter.
- The DAYS function will return the number of days between the two dates.
- Drag the Fill Handle icon to fill the other cells with the formula.
Example 4 – Combine VLOOKUP and DAYS Functions to Get the Number of Days Between Two Dates
- Enter the following formula.
=DAYS(VLOOKUP(F5,C5:D11,1, FALSE),D5)
In the VLOOKUP function, we have taken cell F5 as lookup_value, the range B5:D11 as table_array, used 1 as col_index_num, and used FALSE as range_lookup to get the Exact Match. It will return the value we’re looking for.
The DAYS function will return the total number of days between the looked_up date which is cell F5 and the date of cell C5.
Cell D5 has the end date and C5 has the start date.
- Press Enter.
- The DAYS function will return the number of days between the two dates.
Example 5 – Use of DAYS & TODAY Functions to find Total Days from Today
- Enter the following formula.
=DAYS(TODAY(),C5)
- Press Enter.
- The DAYS function will return the number of total days from today.
- Drag the Fill Handle icon to fill the other cells with the formula.
Calculate Number of Days Between Dates in Excel without Days Function
- Enter the following formula.
=DATEDIF(C5, D5, "d")
- Press Enter.
- The DATEDIF function will return the number of days between two dates in Excel.
- Drag the Fill Handle icon to fill the other cells with the formula.
How to Calculate Working Days Between Two Dates in Excel
- Enter the following formula.
=NETWORKDAYS(C5, D5)
- Press Enter.
- Drag the Fill Handle icon to fill the other cells with the formula.
- The function will return the number of working days between two dates in Excel.
Known Errors of DAYS Function in Excel
String Not Recognized as Date
If you use dates as String, you will see the #VALUE error.
Date Out of Valid Range
Using a date outside the valid date, you will see the #NUM error.
The valid date range dates from 1900 to 10,000 years.
Misspelling Function Name
Download to Practice
<< Go Back to Excel Functions | Learn Excel
Get FREE Advanced Excel Exercises with Solutions!