Contact

YEARFRAC Function (Calligra Sheets)

Date & Time Intermediate Calligra Sheets

Calculate Calligra Sheets YEARFRAC with all five bases. Inspect positive reversed spans, leap-year denominators and the distinct US February adjustment.

Verification status: 20 selected formulas were executed through the Calligra Sheets 25.04.2 calculation engine library in the C locale. Deterministic results were independently reconstructed; 26.08.2 was source-checked only. No GUI-cell or import claim. How formula examples are checked

Convention warning: For February 28 to March 31, 2025, YEARFRAC basis 0 uses 31/360, while DAYS360 gives 30 days. The inspected functions use different US helpers. Basis 1 also has a specific multi-year averaging rule; do not assume a generic day-count standard.

Quick answer: =YEARFRAC(DATE(2025;2;28);DATE(2025;3;31)) returns 0.086111111111 in the tested engine.

Availability and version history

  • Introduced: First release not established; the name is present in Calligra 2.4.0 source.
  • Supported in: Calligra Sheets 26.08.2, with the limitations described here; no retirement established.
  • Scope: Desktop Sheets with the Date & Time module. Formulas use English names and semicolon separators.
  • Checked: October 14, 2026: selected 25.04.2 engine-library formulas and independent calendar/time reconstructions; 26.08.2 source only. The test locale was C, with Monday as its week start. No GUI-cell or import execution is claimed.

What YEARFRAC returns

YEARFRAC returns a fractional number of years from two dates and a day-count basis. It sorts the dates before calculation, so reversing them preserves a nonnegative result. The versioned help incorrectly describes a full-day count and labels its output Int; the callback and the fractional engine results establish the actual return meaning. Official function reference.

Syntax and arguments

=YEARFRAC(start_date;end_date[;basis])

start_date and end_date are required. basis defaults to 0: US 30/360. Use 1 for the inspected actual/actual algorithm, 2 for actual days divided by 360, 3 for actual days divided by 365, or 4 for European 30/360. Converted basis values outside 0–4 return #VALUE!. Fractional basis values are floored. Brackets mark optional arguments and are not typed. Registration and implementation.

Reproducible engine examples

Numeric results are rounded here to twelve decimal places. The reconstruction column applies independent calendar arithmetic or the explicitly inspected time/conversion rule. Date serials use the tested default reference date; they do not show native GUI date formatting.

Formula Engine result Independently reconstructed calendar or time rule
=YEARFRAC(DATE(2025;2;28);DATE(2025;3;31)) 0.086111111111 0.086111111111
=YEARFRAC(DATE(2025;2;28);DATE(2025;3;31);1) 0.084931506849 0.084931506849
=YEARFRAC(DATE(2025;2;28);DATE(2025;3;31);2) 0.086111111111 0.086111111111
=YEARFRAC(DATE(2025;2;28);DATE(2025;3;31);3) 0.084931506849 0.084931506849
=YEARFRAC(DATE(2025;2;28);DATE(2025;3;31);4) 0.088888888889 0.088888888889
=YEARFRAC(DATE(2023;7;1);DATE(2024;7;1);1) 1 1
=YEARFRAC(DATE(2025;3;31);DATE(2025;2;28);0) 0.086111111111 0.086111111111
=YEARFRAC(DATE(2023;1;1);DATE(2025;1;1);1) 2.000912408759 2.000912408759

Practical worksheet

Set A2 to =DATE(2025;2;28) and B2 to =DATE(2025;3;31). Actual elapsed days are 31. Bases 2 and 3 therefore give 31/360 and 31/365. Basis 4 changes March 31 to March 30 but leaves February 28 unchanged, giving 32/360. The table shows all five bases for this pair.

Choose the basis to reproduce the intended calculation and label it beside the result. A successful formula does not establish that its convention matches a specific contract or accounting policy.

Advanced interpretation and checks

For spans longer than the helper’s one-year test, basis 1 divides actual days by the average length of all calendar years touched, including both endpoint years. January 1, 2023 to January 1, 2025 is 731 days; the average is (365+366+365)/3, so the result is 2193/1096 ≈ 2.000912408759, not exactly 2.

For an ordinary at-most-one-year span, the helper chooses 365 or 366 with explicit February/leap-year conditions. A start on February 29 has an invalid same-month/day anniversary in the next year, so the averaging branch remains active: February 29, 2024 to February 28, 2025 gives 730/731 ≈ 0.998632010944.

The expression below verifies the one-day discrepancy between basis 0 and DAYS360 for the February/March pair.

=YEARFRAC(DATE(2025;2;28);DATE(2025;3;31);0)*360-DAYS360(DATE(2025;2;28);DATE(2025;3;31))

The executed result was 1.

Boundaries and troubleshooting

Malformed date text returned actual #VALUE!, but a division-by-zero date argument followed the converter’s empty-value path and produced 125.291666666667 in the shown case. Invalid text or an error in the basis converted to zero. Those behaviors are not input-validation guarantees. Date-only conversion discards time fractions; the printed examples use DATE to avoid locale-dependent parsing. No particular financial agreement or external day-count standard is certified.

Formula Engine result
=YEARFRAC(DATE(2024;2;29);DATE(2025;2;28);1) 0.998632010944
=YEARFRAC(DATE(2025;1;15);DATE(2025;1;15);1) 0
=YEARFRAC(DATE(2025;1;15);DATE(2025;4;15);1.9) 0.246575342466
=YEARFRAC(DATE(2025;1;15);DATE(2025;4;15);"abc") 0.25
=YEARFRAC(DATE(2025;1;15);DATE(2025;4;15);1/0) 0.25
=YEARFRAC(DATE(2025;1;15);DATE(2025;4;15);5) #VALUE!
=YEARFRAC(DATE(2025;1;15);DATE(2025;4;15);-1) #VALUE!
=YEARFRAC("abc";DATE(2025;4;15);0) #VALUE!
=YEARFRAC(1/0;DATE(2025;4;15);0) 125.291666666667
=YEARFRAC(DATE(2025;1;15)) #VALUE!
=YEARFRAC(DATE(2025;1;15);DATE(2025;4;15);0;0) #VALUE!

Official evidence and precision scope

The selected callbacks, date/time module and inspected conversion/time helpers are byte-identical between the retained 25.04.2 and 26.08.2 sources. This establishes source continuity for the described paths, not execution of the later release.