Documentation/Calc Functions/YEARFRAC/en

Function name:
YEARFRAC

Category:
Date and Time

Summary:
Calculates the number of years (including any fractional part of a year) between two dates.

Syntax:
YEARFRAC(StartDate; EndDate[; Basis])

Returns:
Returns a non-negative real number which is the number of years between the two dates passed as arguments, assuming a specified (or default) day count convention.

Arguments:
StartDate is the date (in quotation marks) or a date-time serial number, or a reference to the cell containing one of those types, which is the start or end date of the period for which the calculation is to be carried out.

EndDate is the date (in quotation marks) or a date-time serial number, or a reference to the cell containing one of those types, which is the end or start date of the period for which the calculation is to be carried out.


 * If either StartDate or EndDate is not a valid date expression, then YEARFRAC reports a #VALUE! error.
 * YEARFRAC ignores any time components of StartDate and EndDate.
 * If Basis is non-numeric, then YEARFRAC reports an invalid argument error (Err:502).
 * If Basis is a non-integer value, then YEARFRAC truncates it to an integer.
 * If (after any truncation) Basis does not equal 0, 1, 2, 3, or 4, then YEARFRAC reports an invalid argument error (Err:502).

Related LibreOffice functions:
DATEDIF

ODF standard:
Section 6.10.24, part 2.

Equivalent Excel functions:
YEARFRAC