There is a really useful undocumented function in Excel called Datedif(). It calculates the differences between two given dates in the unit of time specified:
= DATEDIF ( start_date , end_date , unit )
The function has three arguments that need to be entered as part of the function:
- start_date – the first or starting date.
- end_date – the second or last date.
- unit – tells the function to find the number of days (“D”), complete months (“M”), or complete years (“Y”) between the two dates.
The unit parameter MUST be enclosed in quotes and start_date MUST be less than end_date otherwise an error will occur.
More at these links below: