If you want to calculate the number of days between two Excel dates, this can be done by simply subtracting the earlier date from the later date.
For example, if the start date is stored in cell B1 and the end date is stored in cell B2, the number of days between these two dates is calculated by typing the following into any Excel cell:
This method works because Excel dates are internally stored as simple integers. It is only the formatting of an Excel cell that causes its value to be displayed as a date, rather than as a simple number.
This is shown in the example below.
Cell B3 of the following spreadsheet shows a simple Excel date difference calculation. The calculation simply subtracts the date in cell B1 from the date in cell B2.
Formulas:
 Results:

The above subtraction formula returns the result 62.
I.e. There are 62 days between the dates 01/01/2016 and 03/03/2016.
The Excel Days Function also calculates the number of days between two supplied dates. However, the function was only introduced in Excel 2013, so is not available in earlier versions of Excel.
The syntax of the Days function is:
where the end_date and start_date arguments are the two dates that you want to calculate the difference between.
Cell B3 of the following spreadsheet shows the Excel Days function, used to calculate the number of days between the two dates in cells B1 and B2:
Formulas:
 Results:

The above Days function returns the value 62.
I.e. There are 62 days between the dates 01/01/2016 and 03/03/2016.
The Excel Yearfrac Function calculates the number of years between two supplied dates. The result is returned as a decimal value.
Cell B3 of the following spreadsheet shows the Excel Yearfrac function, used to calculate the number of years between the two dates in cells B1 and B2:
Formulas:
 Results:

The above Yearfrac function returns the value 33.17222222.
I.e. There are 33.17 years between the dates 01/01/1983 and 03/03/2016.
The Yearfrac function is also useful if you want to Calculate Age in Excel.