YEARFRAC
The YEARFRAC function calculates the number of years, including fractional years, between the dates as a decimal fraction.
This function can be useful in financial calculations to determine proportional amounts of interest, insurance premiums, and rent payments for a partial annual period.
Syntax
YEARFRAC(start_date, end_date, [calculation_method])
| Argument | Description | Permitted values |
|---|---|---|
| start_date | Start date of the calculation period | Date or reference to a cell containing the date |
| end_date | End date of the calculation period | Date or reference to a cell containing the date |
| [calculation_method] |
| 0, 1, 2, 3, 4 |
Examples of use
Calculation of the fraction of the year between January 1, 2023, and July 1, 2023, using calculation method 1 (actual days/actual days in the year):
=YEARFRAC("01/01/2023", "07/01/2023", 1)
Result: a value approximately equal to 0.5.
Calculation of the fraction of the year between January 1, 2023, and December 31, 2023, based on 0 (US 30/360 method):
=YEARFRAC("01/01/2023", "12.31.2023")
Result: 1.
Notes
Make sure that the cells containing dates have the correct date format for proper functioning.