FINANCE ARITHMETIC / METHOD GUIDE
XIRR and XNPV:
formula and multiple roots.
Short answer: XNPV discounts each dated cash flow over actual calendar days divided by 365 at an annual effective rate. XIRR is a rate above −100% where XNPV equals zero. When net flows change sign only once, at most one rate exists; when they change sign more than once, several rates can zero the same schedule, so a single reported IRR can mislead.
The Actual/365 Fixed formula
Let d0 be the earliest cash-flow date and ci the signed amount on date di (negative paid out, positive received). With an annual effective rate r > −1:
XNPV(r) = Σ ci / (1 + r)(di − d0) / 365
This matches the documented spreadsheet XNPV and XIRR convention (proleptic Gregorian calendar days divided by 365, leap years included). Other day-count conventions such as Actual/360, 30/360 or Actual/Actual yield different numbers.
Why Descartes' rule of signs matters
After netting flows that fall on the same date and sorting chronologically, let S be the number of sign changes in the sequence. By Descartes' rule of signs extended to real exponents, the number of rates above −100% where XNPV(r) = 0 is at most S and has the same parity:
S = 0(all inflows or all outflows): no rate exists (no_sign_change).S = 1(conventional investment): exactly one rate exists above −100%, provided the net flows change sign.S ≥ 2(e.g. upfront cost, interim inflows, end-of-life decommissioning cost): two or more distinct rates can satisfyXNPV(r) = 0.
Worked example with two roots
Consider three annual flows: −100 on 2025-01-01, +230 on 2026-01-01, and −132 on 2027-01-01. Setting u = 1 / (1 + r) gives −100 + 230u − 132u² = 0, which solves to r = 10% and r = 20%. A spreadsheet solver starting from one guess typically returns whichever root is nearest the guess without warning. ScoreCompute's compute_cashflow_metrics returns irr_status: "multiple_roots_possible", sets irr: null and lists candidate roots separately.
A recorded public call (unique root)
Using the classic five-flow spreadsheet schedule (−10,000 on 2008-01-01 followed by +2,750, +4,250, +3,250 and +2,750 through 2009-04-01) at a 9% discount rate, a public MCP call on 23 November 2026 (release 0.18.0) returned npv = 2086.65, irr_status = "unique_root" and irr = 37.34% per year over 456 days, converged in 13 evaluations (inputs and response).
Checking a claimed XIRR or XNPV with a signed receipt
AI assistants and analysts can pass the dated flows and a claimed irr or npv to verify_claim (domain: "cashflow") to get a portable Ed25519 receipt. Whenever irr_status is not unique_root, Verify refuses to certify the claim and returns inconclusive.
Limits
- Arithmetic on supplied figures only: no currency conversion, tax rule, fee schedule, inflation model or financial advice.
- Only Actual/365 Fixed day count is implemented.
- Rates are searched on [−99.99%, +999,900%] per year with binary64 precision; amounts are not rounded to cents.
Sources
- Microsoft Support: XNPV function formula
- Microsoft Support: XIRR function and reference flows
- Jameson (2006), Descartes' rule of signs for generalised polynomials
Try the live XNPV/XIRR 3D demo · Read the engine contract · Verify a cash-flow claim with a receipt
First published 25 November 2026 · Last updated 25 November 2026