Sub topic 11
Using XNPV
Prerequisites and purpose
This chapter assumes you can enter Excel formulas, use cell ranges, calculate percentages, and enter real Excel dates. You should also understand that a cash flow is an amount of money received or paid at a specific time.
XNPV calculates the present value of cash flows that occur on irregular dates. Use it when payments do not happen at evenly spaced intervals, such as monthly invoices, construction payments, or investments made on different calendar dates.
Why ordinary NPV is not enough
The regular NPV function assumes that cash flows occur at equal intervals. For example, each value might arrive exactly one year after the previous value. It discounts the values by period number:
\[ PVt = \frac{CFt}{(1+r)^t} \]
where:
PV_tis the present value of a cash flow.CF_tis the cash flow.ris the discount rate per period.tis the number of periods from the starting point.
If cash flows occur 30, 75, and 140 days after the initial date, assigning them periods 1, 2, and 3 would misstate their timing.
XNPV uses the actual number of days:
\[ XNPV = \sum \frac{CFi}{(1+r)^{(Datei-Date_0)/365}} \]
The function uses a 365-day year, including for leap years.
Building the XNPV inputs
Place dates and cash flows in matching rows. The first date becomes the valuation date, or anchor date. The first cash flow is measured at zero days from that date.
| Date | Cash flow |
|---|---|
| 1/1/2026 | -10000 |
| 1/31/2026 | 2500 |
| 3/17/2026 | 4000 |
| 5/21/2026 | 5000 |
Enter the data in Excel as follows:
A2: 1/1/2026
A3: 1/31/2026
A4: 3/17/2026
A5: 5/21/2026
B2: -10000
B3: 2500
B4: 4000
B5: 5000
D1: 10%
D3: =XNPV(D1, B2:B5, A2:A5)The negative amount represents the initial investment. The positive amounts represent later receipts. The ranges must have the same number of rows, and the dates must be valid Excel dates rather than text that only looks like a date.
Checking the calculation independently
You can reproduce the XNPV calculation with SUMPRODUCT. This is useful for checking a model because it makes the day-based discounting visible.
=SUMPRODUCT(B2:B5 / (1 + D1)^((A2:A5 - A2) / 365))This formula uses A2 as the anchor date. Its result should be approximately equal to =XNPV(D1, B2:B5, A2:A5).
Exercise
Your cash flows are in B2:B6, their dates are in A2:A6, and the discount rate is in D1. Write an XNPV formula and one independent cross-check formula.
Show answer
Use =XNPV(D1,B2:B6,A2:A6) and =SUMPRODUCT(B2:B6/(1+D1)^((A2:A6-A2)/365)).