Formualizer Docs

XNPV

Calculates annualized net present value for irregularly dated cash flows.

Discounting uses an actual-day offset divided by 365 from the first provided date.

The Formualizer engine in this repository at 0.15.0 plus unreleased changes computes the example results. Known differences from Excel are listed on this page.

Syntax

=XNPV(rate, values, dates)

Arguments

ArgumentTypeRequiredDefault
ratenumberRequired—
valuesanyRequired—
datesanyRequired—

Remarks

  • rate is an annual discount rate.
  • Cash-flow sign convention: outflows are negative and inflows are positive.
  • values and dates are flattened to numeric entries; non-numeric entries are ignored.

Error cases

  • Scalar error inputs are propagated; callable inputs return #CALC!.
  • Returns #NUM! when values and dates lengths differ or no numeric pair exists.

Examples

Discount the cash flows according to their actual dates.

Formula =XNPV(0.05,A1:A3,B1:B3)

Input cells
AB
1-100=DATE(2024,1,1)
260=DATE(2024,9,1)
355=DATE(2025,5,1)

Expected result 9.61515964938344

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

Recalculate the value with the final cash flow removed.

Formula =XNPV(0.05,A1:A2,B1:B2)

Input cells
AB
1-100=DATE(2024,1,1)
260=DATE(2024,9,1)

Expected result -41.9253837003986

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

A zero discount rate leaves the signed cash flows undiscounted.

Formula =XNPV(0,A1:A3,B1:B3)

Input cells
AB
1-100=DATE(2024,1,1)
260=DATE(2024,9,1)
355=DATE(2025,5,1)

Expected result 15

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

Every cash flow needs a date in the corresponding position.

Formula =XNPV(0.05,A1:A3,B1:B2)

Input cells
AB
1-100=DATE(2024,1,1)
260=DATE(2024,9,1)
355

Expected result #NUM!

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

Discount four receipts spaced 365 days apart at an annual rate of 10%.

Formula =XNPV(0.10, {-10000,2750,4250,3250,2750}, {0,365,730,1095,1460})

Expected result 332.456799398946

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

Discount three unequally spaced receipts at an annual rate of 8% and include the initial outlay.

Formula =XNPV(0.08, {-5000,1200,1800,2400}, {0,180,365,730})

Expected result -120.410787997008

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

FAQ

How are dates interpreted in XNPV?

Each cash flow is discounted by (date_i - first_date) / 365, so dates must align one-to-one with values.

Implementation

Engine source

On this page