{
  "category": "Date and time functions",
  "display_name": "YEARFRAC",
  "entry_kind": "built_in_function",
  "eval_api": {
    "method": "POST",
    "url": "https://handbook.dnacalc.com/api/eval"
  },
  "function_id": "FUNC.YEARFRAC",
  "implementation_state": {
    "answer_bank": {
      "excel_builds": [
        "20430"
      ],
      "larger_numeric": 0,
      "last_bit": 0,
      "matched": 4506,
      "other_mismatch": 0,
      "refused": 0,
      "rows": 4506,
      "unread": 0,
      "worst_ulp": 0
    },
    "detail": "Recorded: 4,506 in the answer bank and 17 workbook cells.",
    "dnacalc_commit": "9e1884369a678158dd82d3d74188daf986995e87",
    "in_catalogue": true,
    "state": "matches",
    "state_label": "Matches every recorded Excel answer",
    "summary": "Matches all 4,523 recorded answers",
    "workbook_corpus": {
      "cells": 17,
      "matched": 17
    }
  },
  "implementations": [
    {
      "commit": "9e1884369a678158dd82d3d74188daf986995e87",
      "flavour": "excel-compatibility-candidate",
      "language": "Rust",
      "name": "CalcFunc",
      "own_code": [
        "https://github.com/DnaCalc/DnaCalc/blob/9e1884369a678158dd82d3d74188daf986995e87/crates/calc-func/src/catalogue/dates.rs#L331-L336",
        "https://github.com/DnaCalc/DnaCalc/blob/9e1884369a678158dd82d3d74188daf986995e87/crates/calc-func/src/ported/date_kernels.rs#L578-L599",
        "https://github.com/DnaCalc/DnaCalc/blob/9e1884369a678158dd82d3d74188daf986995e87/crates/calc-func/src/ported/date_kernels.rs#L601-L611",
        "https://github.com/DnaCalc/DnaCalc/blob/9e1884369a678158dd82d3d74188daf986995e87/crates/calc-func/src/ported/date_kernels.rs#L613-L642"
      ],
      "repository": "https://github.com/DnaCalc/DnaCalc",
      "shared_code": [
        "catalogue/dates::environment",
        "catalogue/dates::system",
        "catalogue/dates::to_1900",
        "catalogue/dates::date_arg",
        "catalogue/dates::strict_date_arg",
        "locale::days_from_civil",
        "locale::civil_from_days",
        "locale::excel_serial_from_ymd",
        "locale::ymd_from_excel_serial",
        "ported/date_kernels::days_from_civil",
        "ported/date_kernels::civil_from_days",
        "ported/date_kernels::ymd_1900",
        "ported/date_kernels::is_leap",
        "ported/date_kernels::days_in_month",
        "ported/day_count_common::real_days_in_year",
        "ported/day_count_common::excel_actual_actual_year",
        "ported/day_count_common::excel_actual_actual_fraction"
      ],
      "source": "https://github.com/DnaCalc/DnaCalc/blob/9e1884369a678158dd82d3d74188daf986995e87/crates/calc-func/src/catalogue/dates.rs#L331-L336",
      "state": "matches",
      "suite": null,
      "summary": "Matches all 4,523 recorded answers"
    }
  ],
  "json_url": "https://handbook.dnacalc.com/api/functions/FUNC.YEARFRAC.json",
  "name": "YEARFRAC",
  "notes": [
    {
      "basis": "8 recorded readings with an empty B1, one per function, each paired with a reading with TRUE in B1.",
      "documentation": null,
      "evidence": [
        {
          "commit": "c4c5dde7e2dcf735d2849835fc49769e2ab67ba7",
          "locator": "delivered_fn4_blank_date_references_read_serial_zero",
          "note": "recorded answers pinned",
          "path": "apps/dna-onecalc/tests/acceptance.rs",
          "repository": "DnaCalc"
        },
        {
          "commit": "2d0eddcac86413014643af81d646581d54ba57bc",
          "locator": "sheets qa031 and qa032, and the like pairs of each function",
          "note": "recorded readings",
          "path": "crates/calc-func/tests/captures/fn4_questions/functions-fn4-arguments.capture.json",
          "repository": "DnaCalc"
        }
      ],
      "functions": [
        "FUNC.NETWORKDAYS",
        "FUNC.NETWORKDAYS.INTL",
        "FUNC.TBILLEQ",
        "FUNC.TBILLPRICE",
        "FUNC.TBILLYIELD",
        "FUNC.WORKDAY",
        "FUNC.WORKDAY.INTL",
        "FUNC.YEARFRAC"
      ],
      "inferred": null,
      "kind": "quirk",
      "note_id": "FN-WORKDAY-001",
      "open": [
        "An argument left empty in the call was not read here for YEARFRAC and the T-bill functions."
      ],
      "recorded_on": "2026-11-04",
      "repros": [
        {
          "call": "=NETWORKDAYS(B1,5)",
          "correct": null,
          "excel": {
            "bits": "0x4010000000000000",
            "display": "4",
            "kind": "number"
          },
          "input_route": "cell-value2",
          "inputs": [
            {
              "name": "B1",
              "value": {
                "bits": null,
                "display": "(empty cell)",
                "kind": "blank"
              }
            }
          ],
          "recorded_in": "Excel 16.0.20527.20088 Current Channel, Windows 64-bit (NT 10.0.26200), x86-64, AMD Ryzen 7 4800H, en-ZA",
          "source": {
            "commit": "2d0eddcac86413014643af81d646581d54ba57bc",
            "locator": "sheet qa032, row 20, column 10",
            "note": null,
            "path": "crates/calc-func/tests/captures/fn4_questions/functions-fn4-arguments.capture.json",
            "repository": "DnaCalc"
          }
        },
        {
          "call": "=NETWORKDAYS(B1,5)",
          "correct": null,
          "excel": {
            "bits": null,
            "display": "#VALUE!",
            "kind": "error"
          },
          "input_route": "cell-value2",
          "inputs": [
            {
              "name": "B1",
              "value": {
                "bits": null,
                "display": "TRUE",
                "kind": "logical"
              }
            }
          ],
          "recorded_in": "Excel 16.0.20527.20088 Current Channel, Windows 64-bit (NT 10.0.26200), x86-64, AMD Ryzen 7 4800H, en-ZA",
          "source": {
            "commit": "2d0eddcac86413014643af81d646581d54ba57bc",
            "locator": "sheet qa031, row 20, column 10",
            "note": null,
            "path": "crates/calc-func/tests/captures/fn4_questions/functions-fn4-arguments.capture.json",
            "repository": "DnaCalc"
          }
        },
        {
          "call": "=WORKDAY(B1,2)",
          "correct": null,
          "excel": {
            "bits": "0x4008000000000000",
            "display": "3",
            "kind": "number"
          },
          "input_route": "cell-value2",
          "inputs": [
            {
              "name": "B1",
              "value": {
                "bits": null,
                "display": "(empty cell)",
                "kind": "blank"
              }
            }
          ],
          "recorded_in": "Excel 16.0.20527.20088 Current Channel, Windows 64-bit (NT 10.0.26200), x86-64, AMD Ryzen 7 4800H, en-ZA",
          "source": {
            "commit": "2d0eddcac86413014643af81d646581d54ba57bc",
            "locator": "sheet qa054, row 20, column 10",
            "note": null,
            "path": "crates/calc-func/tests/captures/fn4_questions/functions-fn4-arguments.capture.json",
            "repository": "DnaCalc"
          }
        },
        {
          "call": "=WORKDAY(B1,2)",
          "correct": null,
          "excel": {
            "bits": null,
            "display": "#VALUE!",
            "kind": "error"
          },
          "input_route": "cell-value2",
          "inputs": [
            {
              "name": "B1",
              "value": {
                "bits": null,
                "display": "TRUE",
                "kind": "logical"
              }
            }
          ],
          "recorded_in": "Excel 16.0.20527.20088 Current Channel, Windows 64-bit (NT 10.0.26200), x86-64, AMD Ryzen 7 4800H, en-ZA",
          "source": {
            "commit": "2d0eddcac86413014643af81d646581d54ba57bc",
            "locator": "sheet qa053, row 20, column 10",
            "note": null,
            "path": "crates/calc-func/tests/captures/fn4_questions/functions-fn4-arguments.capture.json",
            "repository": "DnaCalc"
          }
        },
        {
          "call": "=NETWORKDAYS.INTL(B1,5,1)",
          "correct": null,
          "excel": {
            "bits": "0x4010000000000000",
            "display": "4",
            "kind": "number"
          },
          "input_route": "cell-value2",
          "inputs": [
            {
              "name": "B1",
              "value": {
                "bits": null,
                "display": "(empty cell)",
                "kind": "blank"
              }
            }
          ],
          "recorded_in": "Excel 16.0.20527.20088 Current Channel, Windows 64-bit (NT 10.0.26200), x86-64, AMD Ryzen 7 4800H, en-ZA",
          "source": {
            "commit": "2d0eddcac86413014643af81d646581d54ba57bc",
            "locator": "sheet qa040, row 20, column 10",
            "note": null,
            "path": "crates/calc-func/tests/captures/fn4_questions/functions-fn4-arguments.capture.json",
            "repository": "DnaCalc"
          }
        },
        {
          "call": "=WORKDAY.INTL(B1,2,1)",
          "correct": null,
          "excel": {
            "bits": "0x4008000000000000",
            "display": "3",
            "kind": "number"
          },
          "input_route": "cell-value2",
          "inputs": [
            {
              "name": "B1",
              "value": {
                "bits": null,
                "display": "(empty cell)",
                "kind": "blank"
              }
            }
          ],
          "recorded_in": "Excel 16.0.20527.20088 Current Channel, Windows 64-bit (NT 10.0.26200), x86-64, AMD Ryzen 7 4800H, en-ZA",
          "source": {
            "commit": "2d0eddcac86413014643af81d646581d54ba57bc",
            "locator": "sheet qa062, row 20, column 10",
            "note": null,
            "path": "crates/calc-func/tests/captures/fn4_questions/functions-fn4-arguments.capture.json",
            "repository": "DnaCalc"
          }
        },
        {
          "call": "=YEARFRAC(B1,5,0)",
          "correct": null,
          "excel": {
            "bits": "0x3f8c71c71c71c71c",
            "display": "0.013888888888888888",
            "kind": "number"
          },
          "input_route": "cell-value2",
          "inputs": [
            {
              "name": "B1",
              "value": {
                "bits": null,
                "display": "(empty cell)",
                "kind": "blank"
              }
            }
          ],
          "recorded_in": "Excel 16.0.20527.20088 Current Channel, Windows 64-bit (NT 10.0.26200), x86-64, AMD Ryzen 7 4800H, en-ZA",
          "source": {
            "commit": "2d0eddcac86413014643af81d646581d54ba57bc",
            "locator": "sheet qa072, row 20, column 10",
            "note": null,
            "path": "crates/calc-func/tests/captures/fn4_questions/functions-fn4-arguments.capture.json",
            "repository": "DnaCalc"
          }
        },
        {
          "call": "=TBILLEQ(B1,5,0.1)",
          "correct": null,
          "excel": {
            "bits": "0x3fb9fddd1b6a757f",
            "display": "0.10152990264255911",
            "kind": "number"
          },
          "input_route": "cell-value2",
          "inputs": [
            {
              "name": "B1",
              "value": {
                "bits": null,
                "display": "(empty cell)",
                "kind": "blank"
              }
            }
          ],
          "recorded_in": "Excel 16.0.20527.20088 Current Channel, Windows 64-bit (NT 10.0.26200), x86-64, AMD Ryzen 7 4800H, en-ZA",
          "source": {
            "commit": "2d0eddcac86413014643af81d646581d54ba57bc",
            "locator": "sheet qa082, row 20, column 10",
            "note": null,
            "path": "crates/calc-func/tests/captures/fn4_questions/functions-fn4-arguments.capture.json",
            "repository": "DnaCalc"
          }
        }
      ],
      "schema": "efh.function-note/v1",
      "statement": "A reference to an empty cell as the first date of these functions reads as serial 0 and gives a normal answer: NETWORKDAYS(B1,5) is 4 and WORKDAY(B1,2) is 3. YEARFRAC(B1,5,0) is 5/360. TRUE in the same cell gives #VALUE!, as a direct TRUE does, so a blank is not treated as the logical FALSE either.",
      "status": "measured",
      "title": "An empty cell as a first date is serial 0, but a logical in that cell is #VALUE!"
    },
    {
      "basis": "19 YEARFRAC readings around serial 60 and the 1904, 2000 and 2004 leap days, 35 readings with serial 0 on all five bases, and 3 readings each from five financial functions.",
      "documentation": null,
      "evidence": [
        {
          "commit": "c4c5dde7e2dcf735d2849835fc49769e2ab67ba7",
          "locator": null,
          "note": "the leap-day test as implemented",
          "path": "crates/calc-func/src/ported/day_count_common.rs",
          "repository": "DnaCalc"
        },
        {
          "commit": "2d0eddcac86413014643af81d646581d54ba57bc",
          "locator": "delivered_scalar_readings_follow_the_application_route",
          "note": "recorded answers pinned",
          "path": "apps/dna-onecalc/tests/acceptance.rs",
          "repository": "DnaCalc"
        },
        {
          "commit": "2d0eddcac86413014643af81d646581d54ba57bc",
          "locator": null,
          "note": "87 recorded readings",
          "path": "crates/calc-func/tests/captures/fn4_questions/YEARFRAC.reading.json",
          "repository": "DnaCalc"
        }
      ],
      "functions": [
        "FUNC.ACCRINTM",
        "FUNC.DISC",
        "FUNC.INTRATE",
        "FUNC.PRICEDISC",
        "FUNC.RECEIVED",
        "FUNC.YEARFRAC"
      ],
      "inferred": null,
      "kind": "quirk",
      "note_id": "FN-YEARFRAC-001",
      "open": [
        "An argument left empty in the call, as in YEARFRAC(,5), has not been read."
      ],
      "recorded_on": "2026-11-04",
      "repros": [
        {
          "call": "YEARFRAC(59, 60, 1)",
          "correct": null,
          "excel": {
            "bits": "0x3f66719f3601671a",
            "display": "0.0027397260273972603",
            "kind": "number"
          },
          "input_route": "cell-value2",
          "inputs": [
            {
              "name": "start_date",
              "value": {
                "bits": "0x404d800000000000",
                "display": "59",
                "kind": "number"
              }
            },
            {
              "name": "end_date",
              "value": {
                "bits": "0x404e000000000000",
                "display": "60",
                "kind": "number"
              }
            },
            {
              "name": "basis",
              "value": {
                "bits": "0x3ff0000000000000",
                "display": "1",
                "kind": "number"
              }
            }
          ],
          "recorded_in": "Excel 16.0.20527.20088, Windows, bitness and CPU not recorded in this reading file",
          "source": {
            "commit": "2d0eddcac86413014643af81d646581d54ba57bc",
            "locator": "fn7-YEARFRAC-fictitious-leap-day-3",
            "note": null,
            "path": "crates/calc-func/tests/captures/fn4_questions/YEARFRAC.reading.json",
            "repository": "DnaCalc"
          }
        },
        {
          "call": "YEARFRAC(1520, 1521, 1)",
          "correct": null,
          "excel": {
            "bits": "0x3f6661ec6a5122f9",
            "display": "0.00273224043715847",
            "kind": "number"
          },
          "input_route": "cell-value2",
          "inputs": [
            {
              "name": "start_date",
              "value": {
                "bits": "0x4097c00000000000",
                "display": "1520",
                "kind": "number"
              }
            },
            {
              "name": "end_date",
              "value": {
                "bits": "0x4097c40000000000",
                "display": "1521",
                "kind": "number"
              }
            },
            {
              "name": "basis",
              "value": {
                "bits": "0x3ff0000000000000",
                "display": "1",
                "kind": "number"
              }
            }
          ],
          "recorded_in": "Excel 16.0.20527.20088, Windows, bitness and CPU not recorded in this reading file",
          "source": {
            "commit": "2d0eddcac86413014643af81d646581d54ba57bc",
            "locator": "fn7-YEARFRAC-fictitious-leap-day-9",
            "note": null,
            "path": "crates/calc-func/tests/captures/fn4_questions/YEARFRAC.reading.json",
            "repository": "DnaCalc"
          }
        },
        {
          "call": "YEARFRAC(0, 5, 0)",
          "correct": null,
          "excel": {
            "bits": "0x3f8c71c71c71c71c",
            "display": "0.013888888888888888",
            "kind": "number"
          },
          "input_route": "cell-value2",
          "inputs": [
            {
              "name": "start_date",
              "value": {
                "bits": "0x0000000000000000",
                "display": "0",
                "kind": "number"
              }
            },
            {
              "name": "end_date",
              "value": {
                "bits": "0x4014000000000000",
                "display": "5",
                "kind": "number"
              }
            },
            {
              "name": "basis",
              "value": {
                "bits": "0x0000000000000000",
                "display": "0",
                "kind": "number"
              }
            }
          ],
          "recorded_in": "Excel 16.0.20527.20088, Windows, bitness and CPU not recorded in this reading file",
          "source": {
            "commit": "2d0eddcac86413014643af81d646581d54ba57bc",
            "locator": "fn7-YEARFRAC-calendar-zero-11",
            "note": null,
            "path": "crates/calc-func/tests/captures/fn4_questions/YEARFRAC.reading.json",
            "repository": "DnaCalc"
          }
        },
        {
          "call": "YEARFRAC(0, 60, 1)",
          "correct": null,
          "excel": {
            "bits": "0x3fc50a8542a150a8",
            "display": "0.1643835616438356",
            "kind": "number"
          },
          "input_route": "cell-value2",
          "inputs": [
            {
              "name": "start_date",
              "value": {
                "bits": "0x0000000000000000",
                "display": "0",
                "kind": "number"
              }
            },
            {
              "name": "end_date",
              "value": {
                "bits": "0x404e000000000000",
                "display": "60",
                "kind": "number"
              }
            },
            {
              "name": "basis",
              "value": {
                "bits": "0x3ff0000000000000",
                "display": "1",
                "kind": "number"
              }
            }
          ],
          "recorded_in": "Excel 16.0.20527.20088, Windows, bitness and CPU not recorded in this reading file",
          "source": {
            "commit": "2d0eddcac86413014643af81d646581d54ba57bc",
            "locator": "fn7-YEARFRAC-fictitious-leap-day-1",
            "note": null,
            "path": "crates/calc-func/tests/captures/fn4_questions/YEARFRAC.reading.json",
            "repository": "DnaCalc"
          }
        },
        {
          "call": "DISC(59, 60, 99, 100, 1)",
          "correct": null,
          "excel": {
            "bits": "0x400d33333333333a",
            "display": "3.650000000000003",
            "kind": "number"
          },
          "input_route": "cell-value2",
          "inputs": [
            {
              "name": "settlement",
              "value": {
                "bits": "0x404d800000000000",
                "display": "59",
                "kind": "number"
              }
            },
            {
              "name": "maturity",
              "value": {
                "bits": "0x404e000000000000",
                "display": "60",
                "kind": "number"
              }
            },
            {
              "name": "pr",
              "value": {
                "bits": "0x4058c00000000000",
                "display": "99",
                "kind": "number"
              }
            },
            {
              "name": "redemption",
              "value": {
                "bits": "0x4059000000000000",
                "display": "100",
                "kind": "number"
              }
            },
            {
              "name": "basis",
              "value": {
                "bits": "0x3ff0000000000000",
                "display": "1",
                "kind": "number"
              }
            }
          ],
          "recorded_in": "Excel 16.0.20527.20088, Windows, bitness and CPU not recorded in this reading file",
          "source": {
            "commit": "2d0eddcac86413014643af81d646581d54ba57bc",
            "locator": "fn7-DISC-fictitious-leap-day-1",
            "note": null,
            "path": "crates/calc-func/tests/captures/fn4_questions/DISC.reading.json",
            "repository": "DnaCalc"
          }
        },
        {
          "call": "DISC(1520, 1521, 99, 100, 1)",
          "correct": null,
          "excel": {
            "bits": "0x400d47ae147ae14f",
            "display": "3.6600000000000033",
            "kind": "number"
          },
          "input_route": "cell-value2",
          "inputs": [
            {
              "name": "settlement",
              "value": {
                "bits": "0x4097c00000000000",
                "display": "1520",
                "kind": "number"
              }
            },
            {
              "name": "maturity",
              "value": {
                "bits": "0x4097c40000000000",
                "display": "1521",
                "kind": "number"
              }
            },
            {
              "name": "pr",
              "value": {
                "bits": "0x4058c00000000000",
                "display": "99",
                "kind": "number"
              }
            },
            {
              "name": "redemption",
              "value": {
                "bits": "0x4059000000000000",
                "display": "100",
                "kind": "number"
              }
            },
            {
              "name": "basis",
              "value": {
                "bits": "0x3ff0000000000000",
                "display": "1",
                "kind": "number"
              }
            }
          ],
          "recorded_in": "Excel 16.0.20527.20088, Windows, bitness and CPU not recorded in this reading file",
          "source": {
            "commit": "2d0eddcac86413014643af81d646581d54ba57bc",
            "locator": "fn7-DISC-fictitious-leap-day-2",
            "note": null,
            "path": "crates/calc-func/tests/captures/fn4_questions/DISC.reading.json",
            "repository": "DnaCalc"
          }
        }
      ],
      "schema": "efh.function-note/v1",
      "statement": "Excel's calendar holds a 29 February 1900, serial 60, that never existed. On basis 1 (actual/actual) it does not make 1900 a leap year: YEARFRAC(59,60,1) is 1/365, where the real 1904-02-29 gives YEARFRAC(1520,1521,1) = 1/366. Serial 0 is accepted as a date: YEARFRAC(0,5,0) is 5/360 and YEARFRAC(0,60,1) is 60/365. Reversed dates give the same answer as in order. ACCRINTM, DISC, INTRATE, PRICEDISC and RECEIVED take the same 365 and 366 on those dates: DISC(59,60,99,100,1) is about 3.65 and DISC(1520,1521,99,100,1) about 3.66.",
      "status": "measured",
      "title": "On basis 1 the fictitious 1900-02-29 is not a leap day, and YEARFRAC takes serial 0 as a date"
    }
  ],
  "schema": "efh.function-reference/v1",
  "section_order": [
    "what-it-does",
    "try-it",
    "quirks",
    "how-to-implement",
    "version-differences",
    "alternatives"
  ],
  "sections": {
    "alternatives": "\n### Relationships\n\n- **[DAYS360](FUNC.DAYS360.md)** — the same two 30/360 conventions, expressed as a day count rather\n  than a year fraction. `YEARFRAC(a,b,0)` should be `DAYS360(a,b,FALSE)/360` and `YEARFRAC(a,b,4)`\n  should be `DAYS360(a,b,TRUE)/360`. Testing those two identities is the cheapest way to probe the\n  documented last-day-of-February defect, since it localizes the disagreement to one of the two\n  functions.\n- **[DATEDIF](FUNC.DATEDIF.md) with `\"Y\"`** — whole elapsed years rather than a fraction. Frequently\n  substituted for `YEARFRAC` in age calculations, with different answers.\n- **[DAYS](FUNC.DAYS.md)** — the raw calendar interval that bases 1, 2 and 3 use as their numerator.\n- **[EOMONTH](FUNC.EOMONTH.md)** — a common source of the exact end-of-February dates Microsoft's\n  caveat names.\n\n\n",
    "how-to-implement": "\n### Notes for implementers\n\n\n1. **Basis 1 needs a written-down definition before it needs code.** Pick a construction, state it\n   precisely (which years, how leap days are counted, what happens for multi-year intervals), and\n   do not claim compatibility until it has been checked. This is the one place in this assignment\n   where \"we implemented what seemed right\" is guaranteed to diverge from something.\n2. **Share the 30/360 adjustment code with `DAYS360`.** Bases 0 and 4 are exactly that function's\n   two methods; two implementations of one rule will eventually disagree, and Microsoft's own\n   documented caveat suggests Excel may already contain such a divergence.\n3. **Truncate every argument to an integer first**, per the documented rule, including `basis`.\n4. **Form the quotient in a fixed, documented order.** The numerator is a small integer and the\n   denominator is 360, 365, 366 or a computed value; different groupings give different last bits.\n   For a `portable-reproducible` flavour this must be pinned explicitly.\n5. **Validate `basis` against 0…4 before anything else**, since it is the one documented `#NUM!`.\n\n\n",
    "quirks": "\n### Result and edge cases\n\n\nReturns a `Number`: a fraction of a year, which may exceed 1 for intervals longer than a year. It\nis not negative when `end_date` precedes `start_date`: reversed dates give the same answer as in\norder (FN-YEARFRAC-001).\n\n- **Microsoft documents a defect in this function.** Verbatim: `YEARFRAC` \"may return an incorrect\n  result when using the US (NASD) 30/360 basis, and the start_date is the last day in February\".\n  That is the vendor stating that basis 0 is wrong on a named input class. The Handbook records it\n  as documented; it has not been characterized here — nobody has determined which February end\n  dates misbehave, by how much, or whether the same inputs affect [DAYS360](FUNC.DAYS360.md), which\n  implements the same adjustment rules.\n- **Basis 1 across a leap day** is where the undocumented denominator rule becomes visible. An\n  interval of exactly one calendar year should give 1 under any sensible actual/actual construction;\n  an interval spanning 29 February is where constructions diverge.\n- **Equal dates** give 0.\n- **Reversed intervals** give the same fraction as in order (FN-YEARFRAC-001); unlike\n  [DATEDIF](FUNC.DATEDIF.md), no error is documented for them.\n- **Floating point.** The result is a quotient of small integers by 360, 365, 366 or an\n  actual/actual denominator. Division by 360 and 365 is inexact in binary, so the last bits of the\n  result depend on the order in which the quotient is formed — which makes `YEARFRAC` one of the few\n  functions in this category with genuine last-bit content, and one where an\n  `excel-bitexact` implementation has something real to match.\n\n\n\n### Errors\n\n\nAs documented on the Microsoft page:\n\n- `#VALUE!` when `start_date` or `end_date` is not a valid date.\n- `#NUM!` when `basis` is less than 0 or greater than 4.\n\nNote that the invalid-date condition is `#VALUE!` here, where several siblings in this category\ndocument `#NUM!` for an out-of-range date. The Handbook records the family's inconsistent\ndocumented error values rather than harmonizing them; see\n[claim language](../model/06-claim-language.md), rule 5.\n\nOrdinary coercion failures and error propagation follow the engine rules in\n[coercion and lifting](../model/02-coercion-and-lifting.md).\n\n\n",
    "sources": "\n- Microsoft 365 support, **YEARFRAC function** —\n  <https://support.microsoft.com/en-us/office/yearfrac-function-3844141e-c76d-4143-82b6-208454ddc6a8>.\n  Source of the basis table, the \"all arguments are truncated to integers\" remark, both error\n  conditions, and the last-day-of-February caveat quoted above.\n- Microsoft 365 support, **DAYS360 function** —\n  <https://support.microsoft.com/en-us/office/days360-function-b9a509fd-49ef-407e-94df-0cbda5718c2a>.\n  Source of the verbatim US (NASD) and European 30/360 adjustment rules underlying bases 0 and 4.\n- [FUNC.DAYS360](FUNC.DAYS360.md) and [FUNC.DATE](FUNC.DATE.md).\n- Handbook chapters [02 coercion and lifting](../model/02-coercion-and-lifting.md) and\n  [06 claim language](../model/06-claim-language.md).\n- `data/functions/FUNC.YEARFRAC.json`, `data/presence/FUNC.YEARFRAC.json` (the shared\n  discount/bill-pricing module), `data/battery/FUNC.YEARFRAC.json`.\n\n",
    "version-differences": "The recorded environments below distinguish a reading from a same-input comparison. Counts describe captured inputs in each environment; overlapping captures and comparisons are not totals of unique worksheet calls.\n\n| Excel 16.0 build | Platform and CPU | Captured inputs |\n|---|---|---:|\n| 20430 | Windows, 64-bit, AMD Ryzen 7 4800H with Radeon Graphics | 3,003 |\n\nThe record contains no same-input comparison between these environments. Reading different inputs on different builds does not establish either a version change or cross-build agreement.\n\n[Recorded environments and comparison details](https://github.com/DnaCalc/ExcelFunctionsHandbook/blob/5dc75391aa5125ccc5abdb095da85950980d6fd8/content/evidence/environments/FUNC.YEARFRAC.json).",
    "what-it-does": "\n`YEARFRAC` converts the interval between two dates into a **fraction of a year**, under a\nselectable day-count convention. It is the time axis of fixed-income arithmetic: every accrual,\nevery discount factor, every bill price ultimately asks \"how much of a year is this\", and this\nfunction is where Excel answers.\n\nStructurally it is a quotient:\n\n> `YEARFRAC(start, end, basis)` = (days between, counted by `basis`) / (days in a year, per\n> `basis`)\n\nBoth the numerator and the denominator depend on the basis, and — this is the part that surprises\npeople — for one basis the denominator is not a constant.\n\n| `basis` | Convention | Numerator | Denominator |\n|---|---|---|---|\n| 0 or omitted | US (NASD) 30/360 | 30/360-adjusted day count | 360 |\n| 1 | Actual/actual | actual calendar days | actual — depends on the period |\n| 2 | Actual/360 | actual calendar days | 360 |\n| 3 | Actual/365 | actual calendar days | 365 |\n| 4 | European 30/360 | 30/360-adjusted day count | 360 |\n\nThe two 30/360 bases are the conventions documented verbatim on the\n[DAYS360](FUNC.DAYS360.md) page — basis 0 is the US (NASD) method with its asymmetric,\nstart-date-dependent end-date rule, and basis 4 is the symmetric European method that adjusts only\nthe 31st. `YEARFRAC(a, b, 0)` and `DAYS360(a, b, FALSE)/360` are the same quantity on the documented\nreading of both pages.\n\n**Basis 1 is the hard one.** \"Actual/actual\" does not name a single algorithm. The denominator must\nbe some notion of \"the length of the year the interval sits in\", and when an interval spans several\nyears, or a leap day, or starts and ends in years of different lengths, there are several defensible\nconstructions — averaging the lengths of the spanned years, using the length of the year containing\nthe start, using 365 or 366 according to whether a leap day falls inside the period, and others.\nExcel's exact rule is **not stated on the documentation page**, and this Handbook has not\nestablished it. That gap is the single most important open question about this function, because\nbasis 1 is the one regulated instruments most often specify.\n\n\n\n### Arguments\n\n\n`YEARFRAC(start_date, end_date, [basis])` — two required arguments and one optional.\n\n**start_date** — \"a date that represents the start date\".\n\n**end_date** — \"a date that represents the end date\".\n\n**basis** — optional; the day-count convention, per the table above. Omitted means 0, the US\n(NASD) 30/360 convention. Microsoft states a general conversion rule for this function that the\nrest of the category does not state so plainly: **\"All arguments are truncated to integers.\"** So\nfractional serials contribute no fractional days, and a fractional `basis` truncates.\n\nThe misunderstood argument is `basis`, and specifically its default. A workbook written against an\nActual/365 instrument that omits `basis` silently gets 30/360 answers, which are close enough to\nlook right and wrong enough to matter over a portfolio.\n\n\n"
  },
  "signature": {
    "display": "YEARFRAC(start_date, end_date, [basis])",
    "parameters": [
      {
        "description": null,
        "name": "start_date",
        "optional": false,
        "repeats": false
      },
      {
        "description": null,
        "name": "end_date",
        "optional": false,
        "repeats": false
      },
      {
        "description": null,
        "name": "basis",
        "optional": true,
        "repeats": false
      }
    ],
    "trailing_repeats": false
  },
  "sources": {
    "metadata": {
      "admission": {
        "label": "implemented",
        "reason": null
      },
      "arity": {
        "max": 3,
        "min": 2
      },
      "category": "Date and time functions",
      "classification": {
        "arg_preparation_profile": "ValuesOnlyPreAdapter",
        "coercion_lift_profile": "Custom",
        "determinism_class": "Deterministic",
        "error_collapse_profile": "None",
        "fec_dependency_profile": "None",
        "host_interaction_class": "None",
        "kernel_signature_class": "Custom",
        "rich_value_usage": "RichBlind",
        "surface_fec_dependency_profile": "None",
        "thread_safety_class": "SafePure",
        "volatility_class": "NonVolatile"
      },
      "descriptions": {
        "long": null,
        "short": "Fraction of a year between two dates under a day-count basis",
        "short_source": "dna-calc-own"
      },
      "docs": {
        "english_description": "Returns the year fraction representing the number of whole days between start_date and end_date",
        "microsoft_url": "https://support.microsoft.com/en-us/office/yearfrac-function-3844141e-c76d-4143-82b6-208454ddc6a8"
      },
      "entry_kind": "built_in_function",
      "localized_family_names": null,
      "localized_names": [
        {
          "locale": "ar-SA",
          "name": "YEARFRAC"
        },
        {
          "locale": "bg-BG",
          "name": "YEARFRAC"
        },
        {
          "locale": "cs-CZ",
          "name": "YEARFRAC"
        },
        {
          "locale": "da-DK",
          "name": "ÅR.BRØK"
        },
        {
          "locale": "de-DE",
          "name": "YEARFRAC"
        },
        {
          "locale": "el-GR",
          "name": "YEARFRAC"
        },
        {
          "locale": "en-AU",
          "name": "YEARFRAC"
        },
        {
          "locale": "en-GB",
          "name": "YEARFRAC"
        },
        {
          "locale": "en-US",
          "name": "YEARFRAC"
        },
        {
          "locale": "es-ES",
          "name": "FRAC.AÑO"
        },
        {
          "locale": "et-EE",
          "name": "YEARFRAC"
        },
        {
          "locale": "fi-FI",
          "name": "YEARFRAC"
        },
        {
          "locale": "fr-FR",
          "name": "FRACTION.ANNEE*"
        },
        {
          "locale": "he-IL",
          "name": "YEARFRAC"
        },
        {
          "locale": "hr-HR",
          "name": "YEARFRAC"
        },
        {
          "locale": "hu-HU",
          "name": "TÖRTÉV"
        },
        {
          "locale": "id-ID",
          "name": "YEARFRAC"
        },
        {
          "locale": "it-IT",
          "name": "YEARFRAC"
        },
        {
          "locale": "ja-JP",
          "name": "YEARFRAC"
        },
        {
          "locale": "ko-KR",
          "name": "YEARFRAC"
        },
        {
          "locale": "lt-LT",
          "name": "YEARFRAC"
        },
        {
          "locale": "lv-LV",
          "name": "YEARFRAC"
        },
        {
          "locale": "nb-NO",
          "name": "ÅRDEL"
        },
        {
          "locale": "nl-NL",
          "name": "JAAR.DEEL"
        },
        {
          "locale": "pl-PL",
          "name": "CZĘŚĆ.ROKU"
        },
        {
          "locale": "pt-BR",
          "name": "YEARFRAC"
        },
        {
          "locale": "pt-PT",
          "name": "FRAÇÃOANO"
        },
        {
          "locale": "ro-RO",
          "name": "YEARFRAC"
        },
        {
          "locale": "ru-RU",
          "name": "ДОЛЯГОДА"
        },
        {
          "locale": "sk-SK",
          "name": "YEARFRAC"
        },
        {
          "locale": "sl-SI",
          "name": "YEARFRAC"
        },
        {
          "locale": "sr-Latn-RS",
          "name": "YEARFRAC"
        },
        {
          "locale": "sv-SE",
          "name": "ÅRDEL"
        },
        {
          "locale": "th-TH",
          "name": "YEARFRAC"
        },
        {
          "locale": "tr-TR",
          "name": "YILORAN işlevi"
        },
        {
          "locale": "uk-UA",
          "name": "YEARFRAC"
        },
        {
          "locale": "vi-VN",
          "name": "YEARFRAC"
        },
        {
          "locale": "zh-CN",
          "name": "YEARFRAC"
        },
        {
          "locale": "zh-HK",
          "name": "YEARFRAC"
        },
        {
          "locale": "zh-TW",
          "name": "YEARFRAC"
        }
      ],
      "signature": {
        "display": "YEARFRAC(start_date, end_date, [basis])",
        "parameters": [
          {
            "description": null,
            "name": "start_date",
            "optional": false,
            "repeats": false
          },
          {
            "description": null,
            "name": "end_date",
            "optional": false,
            "repeats": false
          },
          {
            "description": null,
            "name": "basis",
            "optional": true,
            "repeats": false
          }
        ],
        "trailing_repeats": false
      },
      "surface_name": "YEARFRAC",
      "version_marker": null,
      "xlcall": {
        "code": "451",
        "symbol": "xlfYearfrac"
      }
    },
    "microsoft": "https://support.microsoft.com/en-us/office/yearfrac-function-3844141e-c76d-4143-82b6-208454ddc6a8"
  },
  "try_it": {
    "formula": "=YEARFRAC(DATE(2026,1,1),DATE(2026,7,1),1)"
  },
  "url": "https://handbook.dnacalc.com/functions/YEARFRAC.html",
  "variants": [],
  "versions": [
    {
      "behaviour": "=YEARFRAC(B1,5,0) returned 0.013888888888888888 (0x3f8c71c71c71c71c). Inputs were supplied through cells using Value2. These are controls from this environment, not a same-input comparison with another build.",
      "excel_build": "16.0.20527.20088",
      "observations": [
        {
          "call": "=YEARFRAC(B1,5,0)",
          "excel": {
            "bits": "0x3f8c71c71c71c71c",
            "display": "0.013888888888888888",
            "kind": "number"
          },
          "input_route": "cell-value2",
          "inputs": [
            {
              "name": "B1",
              "value": {
                "bits": null,
                "display": "(empty cell)",
                "kind": "blank"
              }
            }
          ],
          "recorded_in": "Excel 16.0.20527.20088 Current Channel, Windows 64-bit (NT 10.0.26200), x86-64, AMD Ryzen 7 4800H, en-ZA"
        }
      ],
      "platform": "Windows 64-bit (NT 10.0.26200), x86-64, AMD Ryzen 7 4800H, en-ZA",
      "sources": [
        "https://github.com/DnaCalc/ExcelFunctionsHandbook/blob/3345a87/content/notes/FN-WORKDAY-001.json"
      ]
    },
    {
      "behaviour": "YEARFRAC(59, 60, 1) returned 0.0027397260273972603 (0x3f66719f3601671a). YEARFRAC(1520, 1521, 1) returned 0.00273224043715847 (0x3f6661ec6a5122f9). 2 further recorded controls are attached. Inputs were supplied through cells using Value2. These are controls from this environment, not a same-input comparison with another build.",
      "excel_build": "16.0.20527.20088",
      "observations": [
        {
          "call": "YEARFRAC(59, 60, 1)",
          "excel": {
            "bits": "0x3f66719f3601671a",
            "display": "0.0027397260273972603",
            "kind": "number"
          },
          "input_route": "cell-value2",
          "inputs": [
            {
              "name": "start_date",
              "value": {
                "bits": "0x404d800000000000",
                "display": "59",
                "kind": "number"
              }
            },
            {
              "name": "end_date",
              "value": {
                "bits": "0x404e000000000000",
                "display": "60",
                "kind": "number"
              }
            },
            {
              "name": "basis",
              "value": {
                "bits": "0x3ff0000000000000",
                "display": "1",
                "kind": "number"
              }
            }
          ],
          "recorded_in": "Excel 16.0.20527.20088, Windows, bitness and CPU not recorded in this reading file"
        },
        {
          "call": "YEARFRAC(1520, 1521, 1)",
          "excel": {
            "bits": "0x3f6661ec6a5122f9",
            "display": "0.00273224043715847",
            "kind": "number"
          },
          "input_route": "cell-value2",
          "inputs": [
            {
              "name": "start_date",
              "value": {
                "bits": "0x4097c00000000000",
                "display": "1520",
                "kind": "number"
              }
            },
            {
              "name": "end_date",
              "value": {
                "bits": "0x4097c40000000000",
                "display": "1521",
                "kind": "number"
              }
            },
            {
              "name": "basis",
              "value": {
                "bits": "0x3ff0000000000000",
                "display": "1",
                "kind": "number"
              }
            }
          ],
          "recorded_in": "Excel 16.0.20527.20088, Windows, bitness and CPU not recorded in this reading file"
        },
        {
          "call": "YEARFRAC(0, 5, 0)",
          "excel": {
            "bits": "0x3f8c71c71c71c71c",
            "display": "0.013888888888888888",
            "kind": "number"
          },
          "input_route": "cell-value2",
          "inputs": [
            {
              "name": "start_date",
              "value": {
                "bits": "0x0000000000000000",
                "display": "0",
                "kind": "number"
              }
            },
            {
              "name": "end_date",
              "value": {
                "bits": "0x4014000000000000",
                "display": "5",
                "kind": "number"
              }
            },
            {
              "name": "basis",
              "value": {
                "bits": "0x0000000000000000",
                "display": "0",
                "kind": "number"
              }
            }
          ],
          "recorded_in": "Excel 16.0.20527.20088, Windows, bitness and CPU not recorded in this reading file"
        },
        {
          "call": "YEARFRAC(0, 60, 1)",
          "excel": {
            "bits": "0x3fc50a8542a150a8",
            "display": "0.1643835616438356",
            "kind": "number"
          },
          "input_route": "cell-value2",
          "inputs": [
            {
              "name": "start_date",
              "value": {
                "bits": "0x0000000000000000",
                "display": "0",
                "kind": "number"
              }
            },
            {
              "name": "end_date",
              "value": {
                "bits": "0x404e000000000000",
                "display": "60",
                "kind": "number"
              }
            },
            {
              "name": "basis",
              "value": {
                "bits": "0x3ff0000000000000",
                "display": "1",
                "kind": "number"
              }
            }
          ],
          "recorded_in": "Excel 16.0.20527.20088, Windows, bitness and CPU not recorded in this reading file"
        }
      ],
      "platform": "Windows, bitness and CPU not recorded in this reading file",
      "sources": [
        "https://github.com/DnaCalc/ExcelFunctionsHandbook/blob/3345a87/content/notes/FN-YEARFRAC-001.json"
      ]
    },
    {
      "behaviour": "3,003 captured inputs are indexed for this environment. Capture dates: 2026-09-24 to 2026-09-25. This is a reading count, not a comparison with another build.",
      "excel_build": "16.0 build 20430",
      "platform": "Windows, 64-bit, AMD Ryzen 7 4800H with Radeon Graphics",
      "sources": [
        "https://github.com/DnaCalc/ExcelFunctionsHandbook/blob/5dc75391aa5125ccc5abdb095da85950980d6fd8/content/evidence/environments/FUNC.YEARFRAC.json"
      ]
    }
  ]
}