How to use the XNPV function
What is the XNPV function?
The XNPV function calculates the net present value for cash flows that may or may not be periodic. Net present value is used in investment planning and capital budgeting.
Table of Contents
1. Introduction
What is net present value?
Net present value (NPV) is a core concept in finance where the present value of an investment's future cash inflows is calculated and compared to the initial outlay to see if the investment is profitable over time.
What is cash flow?
A cash flow is the net amount of cash moving into or out of a business during a given time period, representing inflows from revenue and outflows for expenses, investments, financing, and dividends.
What is periodic cash flow?
Periodic cash flow is a regular cash inflow or outflow occurring at fixed intervals over time, like an annuity, loan payment, or payroll.
What is non-periodic cash flow?
Non-periodic cash flow is a cash inflow or outflow that occurs at irregular intervals and does not follow a precise schedule, like inventory purchases or one-time dividends.
XNPV related functions in Excel
Function | Description |
---|---|
XNPV(rate, values, dates) | Returns net present value for irregular cash flows |
NPV(rate, value1, value2...) | Returns net present value for regular cash flows |
IRR(values, guess) | Returns internal rate of return for cash flows |
PMT(rate, periods, present value, [future value], [type]) | Returns periodic payment amount |
FV(rate, periods, payment, [present value], [type]) | Returns future value of cash flows |
CUMIPMT(rate, nper, pv, start_period, end_period, type) | Calculates cumulative interest payments. |
DISC(settlement, maturity, pr, redemption, [basis]) | Calculates discount rate or bond equivalent yield |
How is the XNPV Function calculated?
The formula looks like this:
di = the ith, or last, payment date.
d1 = the 0th payment date.
Pi = the ith, or last, payment.
The text representation of the formula shown in the image is:
XNPV = Σ(i=1 to N) [Pi / (1 + rate)^((di - d1)/365)]
N is the total number of payments.
Pi is the ith (or last) payment.
rate is the discount rate.
di is the ith (or last) payment date.
d1 is the 0th payment date.
2. Syntax
XNPV(rate, values, dates)
rate | Required. The discount rate. |
values | Required. A number of values representing cash flow, the first value is optional and may be a cost or payment. Make sure the first value is a negative value if it is a cost or payment. At least one value must be negative and one value must be positive. |
dates | Required. Dates that correspond to the cash flow values. |
What is a discount rate?
The discount rate is the interest rate used to calculate the present value of future cash flows. It accounts for the time value of money - money today is worth more than money in the future. Higher discount rates result in lower net present values.
3. Example 1
You are considering an investment opportunity that will generate the following irregular cash flows:
Cash flows | Dates |
$10,000 | 1/1/2026 |
$12,000 | 6/1/2026 |
$15,000 | 1/1/2028 |
$18,000 | 1/1/2029 |
$20,000 | 1/1/2030 |
If the required rate of return is 8%, what is the XNPV of this investment?
Arguments: XNPV(rate, values, dates)
- rate: 8% (required rate of return)
- values: An array containing the cash flows
(10,000, 12,000, 15,000, 18,000, 20,000) - dates: An array containing the dates corresponding to each cash flow
(e.g., 1/1/2026, 6/1/2026, 1/1/2028, 1/1/2029, 1/1/2030)
Formula in cell C26:
The formula in cell C26 returns $63,467.50 which represents the net present value of the given irregular cash flows.
The image above the shows a chart displaying blue columns representing cash flows amounts. The data labels above each column shows the actual cash flow amount. The x-axis shows the dates and the y-axis the amount in $ (dollars).
The text representation of the math formula is:
XNPV = Σ(i=1 to N) [Pi / (1 + rate)^((di - d1)/365)]
Cash flow 1:
P1 = $10,000
d1 = 1/1/2026 (0th payment date)
PV1 = $10,000 / (1 + 0.08)^((1/1/2026 - 1/1/2026)/365) = $10,000
Cash flow 2:
P2 = $12,000
d2 = 6/1/2026
PV2 = $12,000 / (1 + 0.08)^((6/1/2026 - 1/1/2026)/365)
PV2 = $12,000 / (1 + 0.08)^(151/365) = $11,623.95
Cash flow 3:
P3 = $15,000
d3 = 1/1/2028
PV3 = $15,000 / (1 + 0.08)^(730/365) = $12,860.08
Cash flow 4:
P4 = $18,000
d4 = 1/1/2029
PV4 = $18,000 / (1 + 0.08)^(1096/365) = $14,285.97
Cash flow 5:
P5 = $20,000 d5 = 1/1/2030
PV5 = $20,000 / (1 + 0.08)^(1461)/365) = $14,697.50
Sum the present values of all cash flows to obtain the XNPV.
XNPV = PV1 + PV2 + PV3 + PV4 + PV5
XNPV = $10,000 + $11,623.95 +$12,860.08 + $14,285.97 + $14,697.50
XNPV = $63,467.50
This value matches the calculated value in cell C26.
4. Example 2
You are considering two investment alternatives, A and B. Alternative A generates cash flows of $10,000, $12,000, and $15,000 over the next 3 years, while Alternative B generates cash flows of $8,000, $14,000, and $18,000 over the same period. If the required rate of return is 9%, which alternative has a higher NPV?
Here are the arguments for alternative A:
rate: 9% (required rate of return)
values: An array containing the cash flows for alternative A: [10000, 12000, 15000])
dates: An array containing the dates corresponding to each cash flow for alternative A: [1/1/2025, 1/1/2026, 1/1/2027]
Here are the arguments for alternative B:
rate: 9% (required rate of return)
values: An array containing the cash flows for alternative B: [8000, 14000, 18000])
dates: An array containing the dates corresponding to each cash flow for alternative B: [1/1/2025, 1/1/2026, 1/1/2027])
Formula in cell C25:
The formula in cell C25 returns $35,341.19 which represents the net present value of the given irregular cash flows for alternative A.
Formula in cell F25:
The formula in cell F25 returns $36,779.43 which represents the net present value of the given irregular cash flows for alternative B.
The image displays a chart titled "XNPV function" and two data tables comparing two investment alternatives, Alternative A and Alternative B, using the XNPV (Net Present Value) function in Excel. The chart shows the cash flows for both alternatives A and B over time, represented by vertical bars with colors blue and red respectively.
Based on the XNPV values in cells C25 and F25, alternative B has a higher net present value of $36,779.43 compared to alternative A's $35,341.19, suggesting that alternative B may be the more profitable investment opportunity when considering the irregular cash flow schedules and the specified discount rate of 9%.
5. Why is the function not working?
The XNPV function returns:
- #VALUE! error if arguments are non-numeric.
- #NUM! error if any number in dates precedes the starting date.
- #NUM! error if values and dates don't have the same number of values.
- #VALUE! error if any number in dates is not a valid date.
Functions in 'Financial' category
The XNPV function function is one of 27 functions in the 'Financial' category.
How to comment
How to add a formula to your comment
<code>Insert your formula here.</code>
Convert less than and larger than signs
Use html character entities instead of less than and larger than signs.
< becomes < and > becomes >
How to add VBA code to your comment
[vb 1="vbnet" language=","]
Put your VBA code here.
[/vb]
How to add a picture to your comment:
Upload picture to postimage.org or imgur
Paste image link to your comment.
Contact Oscar
You can contact me through this contact form