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] |
(optional) Method of calculating days. A number from 0 to 4 is allowed: •0 (US, NASD) — all months are rounded to 30 days and all years to 360 days. Used by default. •1 — without rounding •2 — months are not rounded, years are rounded to 360 days •3 — months are not rounded, years are rounded to 365 days •4 (EU) — all months are rounded to 30 days and all years to 360 days By default, 0 |
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.