The YEARFRAC function is to return the fraction of the year between the start_date and the end_date.
Formula:
= YEARFRAC(start_date, end_date, [basis])
Explanations:
- Start_date is required, the start date.
- End_date is required, the end date.
- [Base] is optional, the type of day count basis to use.
Cautions:
- By default, Microsoft Excel uses January 1, 1900 as serial number 1.
- Arguments are truncated to integers when they are not integer.
- The function returns the #NUM! error value when basis < 0 or if basis > 4.
Example 1: The time between 1/18/2016 and 6/18/2016 is 0.41667 years if we use US 30/360 day count basis.
=YEARFRAC(A2,B2)
Example 2: The time between 1/18/2016 and 6/18/2016 is 0.41644 years if we use Actual/365 day count basis.
=YEARFRAC(A5,B5,3)