{
  "category": "Financial functions",
  "display_name": "XIRR",
  "entry_kind": "built_in_function",
  "eval_api": {
    "method": "POST",
    "url": "https://handbook.dnacalc.com/api/eval"
  },
  "function_id": "FUNC.XIRR",
  "implementation_state": {
    "answer_bank": null,
    "detail": "Recorded: 7 workbook cells.",
    "dnacalc_commit": "9e1884369a678158dd82d3d74188daf986995e87",
    "in_catalogue": true,
    "state": "matches",
    "state_label": "Matches every recorded Excel answer",
    "summary": "Matches all 7 recorded answers",
    "workbook_corpus": {
      "cells": 7,
      "matched": 7
    }
  },
  "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/financial.rs#L269-L282",
        "https://github.com/DnaCalc/DnaCalc/blob/9e1884369a678158dd82d3d74188daf986995e87/crates/calc-func/src/ported/cashflow_rate_family.rs#L170-L180",
        "https://github.com/DnaCalc/DnaCalc/blob/9e1884369a678158dd82d3d74188daf986995e87/crates/calc-func/src/ported/cashflow_rate_family.rs#L233-L250",
        "https://github.com/DnaCalc/DnaCalc/blob/9e1884369a678158dd82d3d74188daf986995e87/crates/calc-func/src/ported/cashflow_rate_family.rs#L252-L272",
        "https://github.com/DnaCalc/DnaCalc/blob/9e1884369a678158dd82d3d74188daf986995e87/crates/calc-func/src/ported/cashflow_rate_family.rs#L572-L592",
        "https://github.com/DnaCalc/DnaCalc/blob/9e1884369a678158dd82d3d74188daf986995e87/crates/calc-func/src/ported/cashflow_rate_family.rs#L594-L650",
        "https://github.com/DnaCalc/DnaCalc/blob/9e1884369a678158dd82d3d74188daf986995e87/crates/calc-func/src/ported/cashflow_rate_family.rs#L652-L727",
        "https://github.com/DnaCalc/DnaCalc/blob/9e1884369a678158dd82d3d74188daf986995e87/crates/calc-func/src/ported/cashflow_rate_family.rs#L729-L758"
      ],
      "repository": "https://github.com/DnaCalc/DnaCalc",
      "shared_code": [
        "catalogue/financial::resolved",
        "catalogue/financial::cash_err",
        "catalogue/financial::guess",
        "ported/cashflow_rate_family::numeric_from_cell",
        "ported/cashflow_rate_family::scalar_number_from_eval",
        "ported/cashflow_rate_family::collect_numeric_vector_from_eval",
        "ported/cashflow_rate_family::serial_from_number",
        "ported/cashflow_rate_family::collect_serial_vector_from_eval",
        "ported/cashflow_rate_family::validate_cashflows",
        "ported/cashflow_rate_family::validate_xnpv_inputs",
        "ported/cashflow_rate_family::bounded_rate_solve",
        "ported/cashflow_rate_family::polish_rate",
        "ported/cashflow_rate_family::map_cashflow_rate_error_to_ws"
      ],
      "source": "https://github.com/DnaCalc/DnaCalc/blob/9e1884369a678158dd82d3d74188daf986995e87/crates/calc-func/src/catalogue/financial.rs#L269-L282",
      "state": "matches",
      "suite": null,
      "summary": "Matches all 7 recorded answers"
    }
  ],
  "json_url": "https://handbook.dnacalc.com/api/functions/FUNC.XIRR.json",
  "name": "XIRR",
  "notes": [],
  "schema": "efh.function-reference/v1",
  "section_order": [
    "what-it-does",
    "try-it",
    "quirks",
    "how-to-implement",
    "version-differences",
    "alternatives"
  ],
  "sections": {
    "alternatives": "\n[XNPV](FUNC.XNPV.md) is the paired dated calculation; [NPV](FUNC.NPV.md) and [IRR](FUNC.IRR.md) use equally spaced periods.\n\n\n",
    "how-to-implement": "\nThe mathematical equation is `sum(value_i/(1+r)^t_i)=0`, with `t_i=(date_i-date_0)/365`. It provides a residual, not a complete rule for choosing one root.\n\nThe current reconstruction uses the following routes after validating signed flows and aligned dates:\n\n1. Its internal residual forms `base=1+r` with ordinary binary64 arithmetic. For each input in supplied order it calculates the binary64 year fraction, calls the internal runtime power leaf `crt_pow(base,t_i)`, divides the flow by it, and adds to a binary64 total. Rates at or below `-0.999999999` are outside this current solver’s accepted domain.\n2. For exactly two flows, compute the candidate `(-value_1/value_0)^(1/t_1)-1`. Reject a nonpositive date difference or an invalid ratio. A negative candidate can return directly. For a nonnegative candidate, a negative or zero guess is rejected by the current path; it does not simply publish the closed form.\n3. For the two-flow positive route, evaluate the residual at zero and at the guess. If they have the same sign, repeatedly move the lower endpoint up to the upper one and double the upper rate, with a limit of 128 expansions. Return an endpoint whose residual is exactly zero.\n4. Bisect the bracket. Before testing the midpoint residual, the current route returns the midpoint when `(upper-lower)/abs(midpoint)<=2e-8`; otherwise replace the endpoint with the same residual sign. It permits at most 100 bisections.\n5. For more than two flows, the positive-guess route also brackets and bisects, but uses width `<=1e-8*(1+2*abs(midpoint))`. A failed positive route can fall back to the source’s bounded secant/Newton solver. That fallback has its own derivative and bounds; it is not established by the two-flow recipe.\n\nFor the example, the residual is `-1000+1250/(1+r)`. Starting at guess 0.1 gives a positive residual, as does 0.2; 0.4 gives a negative one. Bisection tests 0.3 and then 0.25, where this simple example reaches zero. On less convenient inputs the width test can publish an approximation before an exactly zero residual appears.\n\nDo not call the public XNPV wrapper as this internal residual: it uses worksheet POWER, stored x87 operations and a different rate guard. The route above describes the cited implementation and its retained controls. Full root-selection coverage, runtime-power last bits and transfer of every stopping boundary remain open.\n\n\n",
    "quirks": "\nValues and dates must align; a date before the first supplied date or differing counts gives `#NUM!`, while invalid dates give `#VALUE!`. Date serials are truncated. At least one positive and one negative flow are required. Later dates may be out of order, but the first supplied date remains the anchor.\n\nSeveral sign changes can admit multiple roots. Guess can affect the selected result and its last digits even when the mathematical root is unique. Microsoft documents an iterative result accuracy of 0.000001 percent and a limit of 100 tries; failure gives `#NUM!`. That public stopping description does not identify every private residual or iteration step.\n\n\n",
    "sources": "\n- [Microsoft: XIRR function](https://support.microsoft.com/en-us/excel/functions/xirr-function), opened 6 November 2026; syntax, documented argument rules and errors.\n- [DnaCalc implementation](https://github.com/DnaCalc/DnaCalc/blob/da3ecc4fb19a3a5529708c311d0e8f05688ac165/crates/calc-func/src/ported/cashflow_rate_family.rs); implementation steps and the limits identified in the text.\n\n",
    "try-it": "\nPut `-1000,1250` in B2:B3 and enter `=DATE(2027,1,1)` and `=DATE(2028,1,1)` in C2:C3. `=XIRR(B2:B3,C2:C3)` is about `0.25`: one year’s growth takes 1000 to 1250.\n\n\n",
    "version-differences": "\nNo same-input comparison between named Excel builds is recorded for this function here. The documented behaviour below is not a measurement of every Excel release.\n\n\n",
    "what-it-does": "\n`XIRR(values,dates,[guess])` finds an annualized rate that makes the date-discounted cash-flow sum zero. It accommodates irregular dates and defaults guess to 0.1.\n\n\n"
  },
  "signature": {
    "display": "XIRR(values, dates, [guess])",
    "parameters": [
      {
        "description": null,
        "name": "values",
        "optional": false,
        "repeats": false
      },
      {
        "description": null,
        "name": "dates",
        "optional": false,
        "repeats": false
      },
      {
        "description": null,
        "name": "guess",
        "optional": true,
        "repeats": false
      }
    ],
    "trailing_repeats": false
  },
  "sources": {
    "metadata": {
      "admission": {
        "label": "implemented",
        "reason": null
      },
      "arity": {
        "max": 3,
        "min": 2
      },
      "category": "Financial functions",
      "classification": {
        "arg_preparation_profile": "RefsVisibleInAdapter",
        "coercion_lift_profile": "Custom",
        "determinism_class": "Deterministic",
        "error_collapse_profile": "None",
        "fec_dependency_profile": "RefOnly",
        "host_interaction_class": "None",
        "kernel_signature_class": "Custom",
        "rich_value_usage": "RichBlind",
        "surface_fec_dependency_profile": "RefOnly",
        "thread_safety_class": "SafePure",
        "volatility_class": "NonVolatile"
      },
      "descriptions": {
        "long": null,
        "short": "Rate at which cash flows on given dates have a net present value of zero",
        "short_source": "dna-calc-own"
      },
      "docs": {
        "english_description": "Returns the internal rate of return for a schedule of cash flows that is not necessarily periodic",
        "microsoft_url": "https://support.microsoft.com/en-us/office/xirr-function-de1242ec-6477-445b-b11b-a303ad9adc9d"
      },
      "entry_kind": "built_in_function",
      "localized_family_names": null,
      "localized_names": [
        {
          "locale": "ar-SA",
          "name": "XIRR"
        },
        {
          "locale": "bg-BG",
          "name": "XIRR"
        },
        {
          "locale": "cs-CZ",
          "name": "XIRR"
        },
        {
          "locale": "da-DK",
          "name": "INTERN.RENTE"
        },
        {
          "locale": "de-DE",
          "name": "XINTZINSFUSS"
        },
        {
          "locale": "el-GR",
          "name": "XIRR"
        },
        {
          "locale": "en-AU",
          "name": "XIRR"
        },
        {
          "locale": "en-GB",
          "name": "XIRR"
        },
        {
          "locale": "en-US",
          "name": "XIRR"
        },
        {
          "locale": "es-ES",
          "name": "TIR.NO.PER"
        },
        {
          "locale": "et-EE",
          "name": "XIRR"
        },
        {
          "locale": "fi-FI",
          "name": "SISÄINEN.KORKO.JAKSOTON"
        },
        {
          "locale": "fr-FR",
          "name": "TRI.PAIEMENTS"
        },
        {
          "locale": "he-IL",
          "name": "XIRR"
        },
        {
          "locale": "hr-HR",
          "name": "XIRR"
        },
        {
          "locale": "hu-HU",
          "name": "XBMR"
        },
        {
          "locale": "id-ID",
          "name": "XIRR"
        },
        {
          "locale": "it-IT",
          "name": "TIR.X"
        },
        {
          "locale": "ja-JP",
          "name": "XIRR"
        },
        {
          "locale": "ko-KR",
          "name": "XIRR"
        },
        {
          "locale": "lt-LT",
          "name": "XIRR"
        },
        {
          "locale": "lv-LV",
          "name": "XIRR"
        },
        {
          "locale": "nb-NO",
          "name": "XIR"
        },
        {
          "locale": "nl-NL",
          "name": "IR.SCHEMA"
        },
        {
          "locale": "pl-PL",
          "name": "XIRR"
        },
        {
          "locale": "pt-BR",
          "name": "XTIR"
        },
        {
          "locale": "pt-PT",
          "name": "XTIR"
        },
        {
          "locale": "ro-RO",
          "name": "XIRR"
        },
        {
          "locale": "ru-RU",
          "name": "ЧИСТВНДОХ"
        },
        {
          "locale": "sk-SK",
          "name": "XIRR"
        },
        {
          "locale": "sl-SI",
          "name": "XIRR"
        },
        {
          "locale": "sr-Latn-RS",
          "name": "XIRR"
        },
        {
          "locale": "sv-SE",
          "name": "XIRR"
        },
        {
          "locale": "th-TH",
          "name": "XIRR"
        },
        {
          "locale": "tr-TR",
          "name": "AİÇVERİMORANI"
        },
        {
          "locale": "uk-UA",
          "name": "XIRR"
        },
        {
          "locale": "vi-VN",
          "name": "XIRR"
        },
        {
          "locale": "zh-CN",
          "name": "XIRR"
        },
        {
          "locale": "zh-HK",
          "name": "XIRR"
        },
        {
          "locale": "zh-TW",
          "name": "XIRR"
        }
      ],
      "signature": {
        "display": "XIRR(values, dates, [guess])",
        "parameters": [
          {
            "description": null,
            "name": "values",
            "optional": false,
            "repeats": false
          },
          {
            "description": null,
            "name": "dates",
            "optional": false,
            "repeats": false
          },
          {
            "description": null,
            "name": "guess",
            "optional": true,
            "repeats": false
          }
        ],
        "trailing_repeats": false
      },
      "surface_name": "XIRR",
      "version_marker": null,
      "xlcall": {
        "code": "429",
        "symbol": "xlfXirr"
      }
    },
    "microsoft": "https://support.microsoft.com/en-us/office/xirr-function-de1242ec-6477-445b-b11b-a303ad9adc9d"
  },
  "try_it": {
    "formula": "=XIRR(B2:B3,C2:C3)",
    "inputs": {
      "B2": -1000,
      "B3": 1250,
      "C2": 46388,
      "C3": 46753
    }
  },
  "url": "https://handbook.dnacalc.com/functions/XIRR.html",
  "variants": [],
  "versions": []
}