Contact

YEARFRAC Function (OpenOffice Calc)

Date & Time Intermediate OpenOffice Calc

Use YEARFRAC in Apache OpenOffice Calc with explicit day-count bases. See its actual/actual implementation, positive reversed intervals and native examples.

Verification status: Eight ordinary reference formulas were recalculated in Apache OpenOffice 4.1.16 on Linux x86-64, Build 9816, through generated native ODF and GUI hard recalculation. Saved identities and results were checked. How formula examples are checked

Quick answer: =YEARFRAC(DATE(2024;1;1);DATE(2024;7;1)) returned 0.5 in the tested Apache OpenOffice 4.1.16 build.

Availability and version history

  • Introduced: First release not established; documented by OpenOffice.org 3.3.
  • Supported in: Apache OpenOffice 4.1.16; this is a verified release, not a final supported version.
  • Scope: Desktop Calc, English function names and semicolon-separated formulas.
  • Checked: October 14, 2026. Eight ordinary reference formulas were recalculated from generated ODF in 4.1.16 on Linux x86-64, Build 9816. Source and independent calendar arithmetic were checked.

What YEARFRAC returns

YEARFRAC expresses a date interval as a fraction of a year under the selected basis. The Apache OpenOffice 4.1.16 helper sorts the endpoints before calculating, so reversed dates give the same nonnegative fraction in these ordinary cases. Basis 1 follows the release’s specific anniversary-and-start-year algorithm; do not assume all applications or financial contracts use the same actual/actual definition. Release implementation.

Syntax and arguments

YEARFRAC(StartDate;EndDate[;Basis])
  • StartDate, EndDate: required date serials or date cells.
  • Basis: optional integer selector, default 0. Values 0 and 4 use US and European 30/360; 1 is the implementation’s actual/actual method; 2 is actual days/360; 3 is actual days/365.
  • Brackets mark an optional argument. Use an explicit basis when the calculation must be auditable.

Eight reproducible examples

The native column contains saved 4.1.16 results; independent references use exact date arithmetic or rational fractions. Numerical values are shown to twelve decimal places where needed. Enter the DATE expressions directly rather than substituting locale-dependent text.

Formula Native 4.1.16 result Independent reference
=YEARFRAC(DATE(2024;1;1);DATE(2024;7;1)) 0.5 0.5
=YEARFRAC(DATE(2024;1;1);DATE(2024;7;1);1) 0.497267759563 0.497267759563
=YEARFRAC(DATE(2024;1;1);DATE(2024;7;1);2) 0.505555555556 0.505555555556
=YEARFRAC(DATE(2024;1;1);DATE(2024;7;1);3) 0.498630136986 0.498630136986
=YEARFRAC(DATE(2024;1;1);DATE(2024;7;1);4) 0.5 0.5
=YEARFRAC(DATE(2024;7;1);DATE(2024;1;1);1) 0.497267759563 0.497267759563
=YEARFRAC(DATE(2023;7;1);DATE(2025;1;1);1) 1.504109589041 1.504109589041
=YEARFRAC(DATE(2024;6;1);DATE(2024;6;1);1) 0 0

Practical worksheet

From January 1 to July 1, 2024, the actual interval is 182 days. Basis 1 returns 182/366 ≈ 0.497267759563, basis 2 returns 182/360 ≈ 0.505555555556, and basis 3 returns 182/365 ≈ 0.498630136986. The two 30/360 bases give 0.5 for these endpoints.

A chosen simple accrual formula might multiply principal, annual rate and the selected fraction. The function does not determine the contractual convention, compounding rule or rounding policy. State those separately and avoid mixing an actual-day numerator with an unrelated denominator.

Advanced interpretation and checks

The pinned basis-1 helper counts completed anniversaries, uses the earlier endpoint’s year length as the fractional denominator, and computes the remaining partial interval with its calendar adjustment. From July 1, 2023 to January 1, 2025 the result is 1+184/365 ≈ 1.504109589041. This is not a promise that every multi-year interval equals total actual days divided by an averaged year length.

The endpoint sort means YEARFRAC(A;B;basis) and YEARFRAC(B;A;basis) agree for the listed valid dates. If a model requires a signed fraction, preserve the direction separately rather than assuming the function returns a negative value. For a zero-length interval the helper returns zero.

Boundaries and troubleshooting

The supported basis selectors are 0 through 4. Use whole date serials and explicit whole selectors. The source rejects unsupported bases through its mode-validation path, but invalid-basis and text-input cases were not executed in this fixture.

The name actual/actual encompasses multiple conventions. For a contractual calculation, verify the required convention against the exact release algorithm and suitable worked dates. This guide establishes the eight stated ordinary cases and the pinned helper, rather than financial suitability or cross-application equivalence.

Official evidence and checking scope

The generated ODF produced the informational load warning “Not all attributes could be read.” The sheet was hard-recalculated and saved separately. All eight ordinary function identities and results were reconciled; a stale SUM cache changed from 999999 to 3 and an uncached SUM returned 7. This establishes the stated examples, not every workbook style or invalid input. Other explanatory identities are independent calculations. The authoring-tool XLSX was not executed in OpenOffice, and its preview values are not the native results reported here.