Contact

XNPV Function (LibreOffice Calc)

Financial Intermediate LibreOffice Calc

Learn the XNPV function in LibreOffice Calc: Returns the net present value for a non-periodic schedule of payments.

Verification status: Consult the documentation, examples and any stated test scope below. How formula examples are checked

Availability and version history

  • Introduced: Documented by LibreOffice 26.8.1.1; original introduction not established.
  • Availability: Supported in LibreOffice 26.8.1.1, verified against its function registry. This identifies a supported release, not a final working version.
  • Scope: Desktop Calc, using the English function name. Availability in other spreadsheet applications is separate.
  • Checked: 2026-10-14 — function reference; versioned support. Documentation/source check; not a new native test. Existing example-specific test claims below retain their stated scope.

XNPV in LibreOffice Calc — discount irregular cash flows by actual dates

Testing scope (13 October 2026): The numerical examples and diagnostics identified as native results come from a recorded LibreOffice Calc 25.2.3.2 Linux run. Its saved formulas and results were checked against the retained workbook, and the numerical examples were independently recalculated. No new Calc run was performed for this review. Current online Help displays 26.8; that application version and other platforms were not tested.

XNPV calculates the net present value of cash payments and receipts occurring at uneven calendar dates. You supply a discount rate, a series of cash flows, and a matching series of payment dates; Calc discounts each payment according to the number of days elapsed from the first date. The result is expressed in the same monetary units as the input amounts, not as a percentage.

Syntax and arguments

=XNPV(Rate; Values; Dates)
Parameter Required? Correct meaning
Rate Yes Annual discount rate, expressed as a decimal or percentage: 0.06 or 6% means 6%. For the standard real-valued equation, it must be greater than −1 (−100%). There is no default.
Values Yes The dated cash flows, including the initial investment amount as the first entry, conventionally negative and subsequent receipts positive. Values are not automatically treated as profits.
Dates Yes A date corresponding one-for-one to each cash flow. The first date is the valuation anchor; other dates must not precede it. Subsequent dates can be out of chronological order as long as each stays paired with its amount.

Unlike IRR or XIRR, XNPV does not search for the discount rate: it evaluates the series at the rate you provide. There is no optional Guess argument. Standard English Calc formulas separate arguments with ; (locale-specific setups can change separators/decimal entry); use real numeric dates, preferably generated by DATE(year;month;day) or date-formatted cells. LibreOffice Financial Functions Part Three — XNPV, consulted 2026-10-13; OpenFormula §6.12.52 (ODF 1.4, 2025-10-06).

Step-by-step example with real dates

Enter the official LibreOffice schedule below in columns A and B. All five dates are genuine spreadsheet date values; if your locale misreads date text, populate A1:A5 with the DATE(...) expressions and apply a date format. Record expenditures as negative amounts.

Date (column A) Cash flow (column B) Purpose
2001-01-01 -10000 Initial cash outflow
2001-02-01 2000 Receipt
2001-03-15 2500 Receipt
2001-05-12 5000 Receipt
2001-08-10 1000 Receipt

Enter the date cells using:

A1: =DATE(2001;1;1)
A2: =DATE(2001;2;1)
A3: =DATE(2001;3;15)
A4: =DATE(2001;5;12)
A5: =DATE(2001;8;10)

Populate B1:B5 as numeric values with the signs shown. Then enter:

=XNPV(6%;B1:B5;A1:A5)

Native result: approximately 323.016893587303, which displays as 323.02 in a two-decimal currency cell. This matches LibreOffice’s official example (323.02). The financial meaning is: at an assumed annual discount rate of 6%, the discounted value of the listed receipts minus the initial outflow is positive by about 323.02 units. It is not a 323% return, and it does not mean the cash payments physically summed to 323.02. Help XNPV worked example, checked 2026-10-13.

Interpreting the sign

At your chosen rate, positive XNPV means discounted receipts exceed discounted outlays within the model; negative XNPV means discounted receipts are insufficient to cover those outlays. This is a financial decision aid, not a guaranteed investment outcome: results depend heavily on the reasonableness of your rate and projected cash flows. In this example, the undiscounted sum of all flows is 500, while XNPV at 6% is 323.02 because the later receipts are worth less when translated to the first date.

Reproduce the official example with cell-based rate

Put 6% in D1, then use:

=XNPV(D1;B1:B5;A1:A5)

The result should again be about 323.0169. To compare several projects with the same hurdle rate, lock the rate reference as $D$1 when copying the formula. Avoid placing date labels in the referenced rows: a heading row included by accident can change the result or yield an error.

Formula and mathematical basis

For N cash flows C1 … CN, dates d1 … dN, and annual discount rate r, OpenFormula defines:

XNPV(r, C, d) = Σ[ Ci / (1 + r)^((di − d1) / 365) ]

The first date is the zero-day anchor, so the first cash flow is not discounted ((d1−d1)/365 = 0). Each later amount is compounded over its exact date difference divided by 365 days; this calculation does not adopt 366 as its year denominator during leap years. For ordinary real-valued finance calculations r > −1 ensures a positive exponential base. OASIS OpenFormula §6.12.52; standard published 2025-10-06, LibreOffice Help, accessed 2026-10-13.

Audit XNPV without relying on the XNPV function

In column C, calculate each present-value contribution individually. Set the rate in D1 to 6%. For row 1 enter:

=B1/(1+$D$1)^((A1-$A$1)/365)

Fill the same expression down through C5 (the A1 and B1 row references adjust; $D$1 and $A$1 stay fixed). Finally calculate:

=SUM(C1:C5)

This reproduces the published OpenFormula equation and should agree with =XNPV($D$1;B1:B5;A1:A5) within floating-point precision. Evidence distinction: the equation and its independently computed result were checked, but this exact five-cell auditing worksheet layout was not separately executed as a native Calc assertion. The historical test workbook did execute the built-in XNPV formula and compared it against independently calculated results. The audit layout is offered as a reproducible check for the reader.

More verified examples

Two payments one normal year apart

Put A1 =DATE(2023;1;1), B1 -1000, A2 =DATE(2024;1;1), B2 1100. The interval is 365 days.

=XNPV(10%;B1:B2;A1:A2)

Native result: approximately 0 (absolute floating-point residual around 1.1 × 10⁻¹³), because −1000+1100/(1.10)^(365/365)=0.

At 6% instead, =XNPV(6%;B1:B2;A1:A2) returns approximately 37.7358490566. This is the additional value of the cash flow compared with a 6% annual hurdle rate, not a 37.7% annual return.

Leap-year example changes the present value

Change A1 to =DATE(2024;1;1) and A2 to =DATE(2025;1;1). The gap is 366 days. At 10%, the native result is approximately −0.261089690439 rather than exactly zero, because the calculation discounts for 366/365 years. At 6%, native Calc returned 37.5701972524. The corresponding XIRR, based on these same flows, was approximately 9.9713585934%, which makes XNPV approximately zero. Native Calc 25.2.3.2 tests conducted 2026-10-13; official fixed-365 basis.

Discount rates change the decision

Return to the official five-flow example. The tested XNPV results were:

Annual discount rate =XNPV(rate;B1:B5;A1:A5) native result
0% 500.000000000000
6% 323.016893587303
10% 212.453298133832
~18.2843485821% Approximately 0 (because this is XIRR for that schedule)

A positive XNPV at 6% and a smaller positive value at 10% are exactly what discounted cash-flow theory predicts for this particular conventionally signed schedule. Changing Rate does not change the underlying cash flows. Native Calc 25.2.3.2 test record, 2026-10-13; OpenFormula §6.12.52.

Advanced uses and cautions

Screening investment or capital projects

Use a documented hurdle rate reflecting the cost of capital and project risk to discount each project’s dated forecast. Include acquisition expenditures, later funding, operating cash receipts, disposal proceeds and relevant fees on their actual dates. Calculate XNPV for every candidate using the same valuation date convention; different first dates mean each project’s XNPV is as of a different point in time and the numbers should not be compared without adjustment.

Forecast scenarios and sensitivity analysis

Put assumed rates in several cells (for example E2 4%, E3 6%, E4 8%). Next to each, use =XNPV(E2;$B$1:$B$5;$A$1:$A$5) and copy down. This provides a rate-sensitivity table. Run separate scenarios for delays in later receipts or changes in required funding; a delay may reduce XNPV even if the total cash received stays identical.

Break-even rate via XIRR

With an ordinary investment that has an economically meaningful rate root, the following two results are connected:

=XIRR(B1:B5;A1:A5)
=XNPV(XIRR(B1:B5;A1:A5);B1:B5;A1:A5)

The first returns a rate and the second approximately zero money units. In the native ODS workbook, seven cross-function scenarios passed this identity, including a 366-day leap-year case. For cash flows with multiple changes of sign, an XIRR root might be nonunique; do not treat the returned rate as automatically the only economically defensible solution. OpenFormula §§6.12.51–52, 2025-10-06.

Payments on the same day or in a different order

Two payments may share one date; they receive the same discount exponent, and can usually be combined without changing the mathematical XNPV if all other paired cash flows remain identical. Likewise, dates after the first date need not be sorted, but never reorder dates alone: every amount must retain its date. The native test suite included both same-date cash flows and unsorted later dates and matched independent discounted-sum calculations. The first date remains the required anchor. LibreOffice Help, reviewed 2026-10-13.

Errors, data limits, and version-specific behavior

Situation Recommended action What was checked
Rate is −100% Prevent (1 + Rate) = 0; use a rate above −100%. Native Calc returned Err:502 at -1 in the two-flow diagnostic. OASIS §6.12.52; native diagnostic, 25.2.3.2.
Rate is below −100% Validate explicitly, even if Calc returns a number. Native =XNPV(-1.01;...) for a one-year two-flow example returned −12100 instead of rejecting the out-of-domain rate; don’t rely on this accidental integer-power case. Native diagnostic versus the OASIS recommendation to keep Rate greater than −1.
A date after row 1 is earlier than row 1 Move the true initial valuation event to the first row or correct data. Although the ODF constraint requires dates ≥ first date, the tested Calc returned 20.1254048955369 for one earlier-date diagnostic instead of an error. OpenFormula §6.12.52 versus native 25.2.3.2.
Different counts in Values and Dates Make ranges equal in length and align each event. The tested mismatch returned Err:502. Native diagnostics; official constraints.
Some amounts are blank or text Treat missing amounts as data-quality issues. Native Calc silently returned a plausible result with an empty/text middle flow, rather than alerting the author. Native diagnostics; source Help warns of ignored nonnumeric range entries for XIRR.
Only positive amounts A positive XNPV may be mathematically defined, but an investment-case interpretation is dubious without any cost. Native Calc evaluated the homogeneous-sign case; LibreOffice Help’s investment example expects both signs. Native observation vs Help wording.
Zero discount rate The sum of nominal flows is returned; in the simple native diagnostic, flows −100 and 120 yielded 20. Native observation and XNPV equation.
Locale displays a date that is actually text Use DATE(...), apply a date format, verify the cell contains a numeric date value. Text dates are not portable. Defensive input advice, not a tested cross-platform claim.
Unexpected currency/rate units XNPV returns the input currency unit; Rate is annual. It does not return a percentage or the rate implied by the flows. OpenFormula formula and native examples.

Defensive validation formula

If the discount rate is in D1 and the data are in A1:A5/B1:B5, a simple guard for the rate domain is:

=IF(D1<=-1;NA();XNPV(D1;B1:B5;A1:A5))

For dates, visually verify that A1 is the earliest date and no data row precedes it. For a contiguous numeric date column, the following proposed guard can be used after validating that every date cell is truly numeric:

=IF(OR(COUNT(A1:A5)<>ROWS(A1:A5);MIN(A1:A5)<A1);NA();XNPV(D1;B1:B5;A1:A5))

These defensive formulas follow documented Calc functions, but were not individually included in the native assertion workbook. They are suggested checks, not claimed verified native results. They do not validate the sign of the cash flows, the economic appropriateness of the rate, or the chronological pairing if dates were detached from values.

How XNPV differs from the similar functions

Function Input model Output
XNPV Given discount rate + dated amounts Net present value (money)
XIRR Dated amounts, optional starting guess Implied annual rate (percentage)
NPV Given rate + equally spaced cash flows Periodic-model present value (money)
IRR Equally spaced cash flows Implied rate per period
MIRR Periodic flows + finance/reinvestment rates Modified periodic return

A common mistake is =NPV(rate; all_cash_flows) when the first row is an immediate negative investment: many NPV conventions discount every supplied array item one period, while XNPV treats its first date as t = 0. Even on regular schedules, verify the timing convention before comparing outputs.

Evidence and compatibility

LibreOffice native execution: A recalculated .ods test workbook using the LibreOffice Calc 25.2.3.2/Linux UNO engine was evaluated on 2026-10-13, alongside independent Python datetime/mathematical discount calculations. The test suite recorded 52 independent XNPV numerical assertions (including cross-checks against XIRR) and additional native error/input diagnostics. Results above are native where explicitly labeled. Some UNO formula strings are internally represented as COM.SUN.STAR.SHEET.ADDIN.ANALYSIS.GETXNPV even though users enter =XNPV(...); these are implementation formula identifiers, not recommended user-facing syntax.

Official documentation and scope: LibreOffice Financial Functions Part Three — XNPV (retrieved 2026-10-13; /latest/ can lead to newer Help than the tested Calc version), and the OpenDocument v1.4 OpenFormula specification, Part 4 §6.12.52 (standard dated 2025-10-06, read 2026-10-13). OpenFormula defines the standard function name and arithmetic but is not evidence that Excel, other Calc editions, Windows/macOS ports, or other programs behave identically; those environments and XLSX round trips were not tested.