Syntax. YEARFRAC(start_date,end_date,basis)
Definition. This function converts the interval between the start date and the end date into a fraction of a year.
Arguments
start_date (required). The date that represents the start of the calculation.
end_date (required). The date that represents the end of the calculation.
basis (optional). Indicates the basis on which the interval days are calculated. The following options are available:
0 (or no value). USA (NASD) 30/360
1. Actual/Actual
2. Actual/360
3. Actual/365
4. Europe 30/360
Background. With the YEARFRAC() function, you can compare the duration of claims and liabilities. This function is related to the financial functions (see Chapter 15).
For more information about saving dates in Excel, see the section titled The Excel Date System in Chapter 2.
You need to pay attention to the following when working with this function:
All arguments are truncated to integers by removing the decimal places.
If the start or end date isn’t a valid date, the YEARFRAC() function returns the #VALUE!
error.
If the basis is less than 0 or greater than 4, the YEARFRAC() function returns the #NUMBER!
error.
Example. For the credit period from January 1, 2008 through October 10, 2009, the formula
=YEARFRAC("01/01/2008","10/10/2009")
calculates a duration of 1.775
years based on a month with 30 days and a year with 360 days. More examples (see Figure 7-9) include:
=YEARFRAC("01/01/2010","10/10/2011",1)
returns a value of 1.77260
.
=YEARFRAC("01/01/2010","10/10/2011",2)
returns a value of 1.79722
.
=YEARFRAC("01/01/2010","10/10/2011",3)
returns a value of 1.77260
.
=YEARFRAC("01/01/2010","10/10/2011",4)
returns a value of 1.77500
.