{
  "category": "Financial functions",
  "display_name": "XNPV",
  "entry_kind": "built_in_function",
  "eval_api": {
    "method": "POST",
    "url": "https://handbook.dnacalc.com/api/eval"
  },
  "function_id": "FUNC.XNPV",
  "implementation_state": {
    "answer_bank": {
      "excel_builds": [
        "20131",
        "?"
      ],
      "larger_numeric": 0,
      "last_bit": 0,
      "matched": 3406,
      "other_mismatch": 0,
      "refused": 0,
      "rows": 3406,
      "unread": 0,
      "worst_ulp": 0
    },
    "detail": "Recorded: 3,406 in the answer bank and 8 workbook cells.",
    "dnacalc_commit": "9e1884369a678158dd82d3d74188daf986995e87",
    "in_catalogue": true,
    "state": "matches",
    "state_label": "Matches every recorded Excel answer",
    "summary": "Matches all 3,414 recorded answers",
    "workbook_corpus": {
      "cells": 8,
      "matched": 8
    }
  },
  "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#L252-L268",
        "https://github.com/DnaCalc/DnaCalc/blob/9e1884369a678158dd82d3d74188daf986995e87/crates/calc-func/src/ported/cashflow_rate_family.rs#L527-L570"
      ],
      "repository": "https://github.com/DnaCalc/DnaCalc",
      "shared_code": [
        "catalogue/financial::resolved",
        "catalogue/financial::cash_err",
        "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_xnpv_inputs",
        "ported/cashflow_rate_family::map_cashflow_rate_error_to_ws",
        "ported/excel_numeric::backend::sqrt",
        "ported/excel_numeric::binary_with",
        "ported/excel_numeric::excel_pow_positive",
        "ported/excel_numeric::excel_pow_chain",
        "ported/excel_numeric::excel_x87_add",
        "ported/excel_numeric::excel_x87_mul",
        "ported/excel_numeric::excel_x87_div",
        "ported/excel_numeric::excel_x87_recip",
        "ported/excel_numeric/x87::mul",
        "ported/excel_numeric/x87::add",
        "ported/excel_numeric/x87::div",
        "ported/excel_numeric/x87::recip",
        "ported/excel_numeric/x87_chains::pow2_positive",
        "ported/excel_numeric/x87_chains::pow2",
        "ported/excel_numeric/x87_chains::exp_ext",
        "ported/excel_numeric/x87_chains::exp_with",
        "ported/excel_numeric/x87_chains::excel_exp",
        "ported/excel_numeric/x87_chains::log_with",
        "ported/excel_numeric/x87_chains::excel_log",
        "ported/power_fn::exact_integer_magnitude",
        "ported/power_fn::accept_negative_base_odd_root",
        "ported/power_fn::binexp_positive",
        "ported/power_fn::power_kernel"
      ],
      "source": "https://github.com/DnaCalc/DnaCalc/blob/9e1884369a678158dd82d3d74188daf986995e87/crates/calc-func/src/catalogue/financial.rs#L252-L268",
      "state": "matches",
      "suite": null,
      "summary": "Matches all 3,414 recorded answers"
    }
  ],
  "json_url": "https://handbook.dnacalc.com/api/functions/FUNC.XNPV.json",
  "name": "XNPV",
  "notes": [],
  "schema": "efh.function-reference/v1",
  "section_order": [
    "what-it-does",
    "try-it",
    "quirks",
    "how-to-implement",
    "version-differences",
    "alternatives"
  ],
  "sections": {
    "alternatives": "\n[XIRR](FUNC.XIRR.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": "\nUse `D` for ordinary binary64 storage and [R](../model/09-staged-arithmetic.md) for the stored x87-style operation.\n\n1. Validate finite numeric flows, aligned truncated dates and the first-date anchor. Require a finite positive rate in the current public route.\n2. Calculate `base=R(1+rate)` and initialize `total=0`.\n3. For each flow in its supplied order, calculate `years=D((date-date_0)/365)`. Call the public worksheet [POWER](FUNC.POWER.md) route on `(base,years)`; integer year counts can select its integer-exponent path.\n4. Store `term=R(value/power)`, then `total=R(total+term)`. Preserve every store and the forward accumulation order. Apply the final finite-result and worksheet publication rules.\n\nFor the example, the year counts are zero and one, the powers one and 1.25, and the terms minus 1000 and plus 1000. The stored sum is zero. By contrast, putting the first payment into NPV would discount it by one period.\n\nThis current arithmetic chain is distinct from XIRR’s runtime-power, ordinary-binary64 residual. POWER’s complete fractional-exponent behaviour and transfer to other environments are not solved by the dated-sum loop.\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. The first date is an anchor, rather than an instruction to sort the inputs.\n\nThe current XNPV kernel requires a positive rate and returns `#NUM!` at zero or a negative rate, even when the mathematical dated sum is finite. Its source records that guard as measured; the opened Microsoft page does not explicitly state it. This differs from the internal residual used by XIRR, whose iterates can go negative.\n\nMicrosoft describes both a positive and a negative cash flow as required. The current helper and its retained all-positive source control accept `100,200` at dates `45000,45100` and rate `0.1`, giving about `294.8451203808644`. Keep this source-scoped observation separate from the documented sign requirement.\n\n\n",
    "sources": "\n- [Microsoft: XNPV function](https://support.microsoft.com/en-us/excel/functions/xnpv-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. `=XNPV(0.25,B2:B3,C2:C3)` is near zero: the first amount is undiscounted and the second divides by 1.25.\n\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| 20131 | Windows, bitness not recorded, AMD Ryzen 7 4800H with Radeon Graphics | 1,703 |\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.XNPV.json).",
    "what-it-does": "\n`XNPV(rate,values,dates)` discounts cash flows from their actual dates to the first supplied date. Annual exponents use day differences divided by 365, rather than a selectable bond basis.\n\n\n"
  },
  "signature": {
    "display": "XNPV(rate, values, dates)",
    "parameters": [
      {
        "description": null,
        "name": "rate",
        "optional": false,
        "repeats": false
      },
      {
        "description": null,
        "name": "values",
        "optional": false,
        "repeats": false
      },
      {
        "description": null,
        "name": "dates",
        "optional": false,
        "repeats": false
      }
    ],
    "trailing_repeats": false
  },
  "sources": {
    "metadata": {
      "admission": {
        "label": "implemented",
        "reason": null
      },
      "arity": {
        "max": 3,
        "min": 3
      },
      "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": "Net present value of cash flows on given dates",
        "short_source": "dna-calc-own"
      },
      "docs": {
        "english_description": "Returns the net present value for a schedule of cash flows that is not necessarily periodic",
        "microsoft_url": "https://support.microsoft.com/en-us/office/xnpv-function-1b42bbf6-370f-4532-a0eb-d67c16b664b7"
      },
      "entry_kind": "built_in_function",
      "localized_family_names": null,
      "localized_names": [
        {
          "locale": "ar-SA",
          "name": "XNPV"
        },
        {
          "locale": "bg-BG",
          "name": "XNPV"
        },
        {
          "locale": "cs-CZ",
          "name": "XNPV"
        },
        {
          "locale": "da-DK",
          "name": "NETTO.NUTIDSVÆRD"
        },
        {
          "locale": "de-DE",
          "name": "XKAPITALWERT"
        },
        {
          "locale": "el-GR",
          "name": "XNPV"
        },
        {
          "locale": "en-AU",
          "name": "XNPV"
        },
        {
          "locale": "en-GB",
          "name": "XNPV"
        },
        {
          "locale": "en-US",
          "name": "XNPV"
        },
        {
          "locale": "es-ES",
          "name": "VNA.NO.PER"
        },
        {
          "locale": "et-EE",
          "name": "XNPV"
        },
        {
          "locale": "fi-FI",
          "name": "NNA.JAKSOTON"
        },
        {
          "locale": "fr-FR",
          "name": "VAN.PAIEMENTS"
        },
        {
          "locale": "he-IL",
          "name": "XNPV"
        },
        {
          "locale": "hr-HR",
          "name": "XNPV"
        },
        {
          "locale": "hu-HU",
          "name": "XNJÉ"
        },
        {
          "locale": "id-ID",
          "name": "XNPV"
        },
        {
          "locale": "it-IT",
          "name": "VAN.X"
        },
        {
          "locale": "ja-JP",
          "name": "XNPV"
        },
        {
          "locale": "ko-KR",
          "name": "XNPV"
        },
        {
          "locale": "lt-LT",
          "name": "XNPV"
        },
        {
          "locale": "lv-LV",
          "name": "XNPV"
        },
        {
          "locale": "nb-NO",
          "name": "XNNV"
        },
        {
          "locale": "nl-NL",
          "name": "NHW2"
        },
        {
          "locale": "pl-PL",
          "name": "XNPV"
        },
        {
          "locale": "pt-BR",
          "name": "XVPL"
        },
        {
          "locale": "pt-PT",
          "name": "XVAL"
        },
        {
          "locale": "ro-RO",
          "name": "XNPV"
        },
        {
          "locale": "ru-RU",
          "name": "ЧИСТНЗ"
        },
        {
          "locale": "sk-SK",
          "name": "XNPV"
        },
        {
          "locale": "sl-SI",
          "name": "XNPV"
        },
        {
          "locale": "sr-Latn-RS",
          "name": "XNPV"
        },
        {
          "locale": "sv-SE",
          "name": "XNUVÄRDE"
        },
        {
          "locale": "th-TH",
          "name": "XNPV"
        },
        {
          "locale": "tr-TR",
          "name": "ANBD"
        },
        {
          "locale": "uk-UA",
          "name": "XNPV"
        },
        {
          "locale": "vi-VN",
          "name": "XNPV"
        },
        {
          "locale": "zh-CN",
          "name": "XNPV"
        },
        {
          "locale": "zh-HK",
          "name": "XNPV"
        },
        {
          "locale": "zh-TW",
          "name": "XNPV"
        }
      ],
      "signature": {
        "display": "XNPV(rate, values, dates)",
        "parameters": [
          {
            "description": null,
            "name": "rate",
            "optional": false,
            "repeats": false
          },
          {
            "description": null,
            "name": "values",
            "optional": false,
            "repeats": false
          },
          {
            "description": null,
            "name": "dates",
            "optional": false,
            "repeats": false
          }
        ],
        "trailing_repeats": false
      },
      "surface_name": "XNPV",
      "version_marker": null,
      "xlcall": {
        "code": "430",
        "symbol": "xlfXnpv"
      }
    },
    "microsoft": "https://support.microsoft.com/en-us/office/xnpv-function-1b42bbf6-370f-4532-a0eb-d67c16b664b7"
  },
  "try_it": {
    "formula": "=XNPV(0.25,B2:B3,C2:C3)",
    "inputs": {
      "B2": -1000,
      "B3": 1250,
      "C2": 46388,
      "C3": 46753
    }
  },
  "url": "https://handbook.dnacalc.com/functions/XNPV.html",
  "variants": [],
  "versions": [
    {
      "behaviour": "1,703 captured inputs are indexed for this environment. Capture dates: 2026-07-10 to 2026-07-10. This is a reading count, not a comparison with another build.",
      "excel_build": "16.0 build 20131",
      "platform": "Windows, bitness not recorded, AMD Ryzen 7 4800H with Radeon Graphics",
      "sources": [
        "https://github.com/DnaCalc/ExcelFunctionsHandbook/blob/5dc75391aa5125ccc5abdb095da85950980d6fd8/content/evidence/environments/FUNC.XNPV.json"
      ]
    }
  ]
}