NPV Calculator: Net Present Value, IRR, XNPV and XIRR Explained
By FindMySum · Last reviewed
This NPV calculator answers a simple question about any investment with uneven cash flows: is it worth more than it costs, once you account for the time value of money? You type the cash flows, starting with the amount you invest, choose a discount rate, and it returns the net present value, the internal rate of return, the profitability index and the payback period. It follows the same definitions as the NPV, IRR, XNPV and XIRR functions in Microsoft Excel, so you can check the result in a spreadsheet.
What net present value measures
A dollar received in five years is worth less than a dollar today, because today's dollar could be invested in the meantime. Discounting reverses that growth: a cash flow of CF received t periods from now is worth CF ÷ (1 + r)ᵗ today, where r is the rate you could earn elsewhere on an investment of similar risk. Net present value adds up every discounted cash flow, the initial investment included:
NPV = CF₀ + CF₁ ÷ (1 + r) + CF₂ ÷ (1 + r)² + … + CFₙ ÷ (1 + r)ⁿ
A positive NPV means the project returns more than r, by that many dollars in today's money. A negative NPV means you would be better off earning r somewhere else. An NPV of exactly zero means the project earns exactly r, and the rate at which that happens is the internal rate of return.
The Excel NPV trap
The most common spreadsheet mistake with NPV comes from how Excel's function is defined. Excel's NPV treats the first value you pass as arriving at the end of period 1 and discounts it. If you write =NPV(8%, B1:B6) with the initial investment in B1, Excel discounts the investment by one year, as if you paid it a year from now. Microsoft's own help page shows both uses: its first example deliberately discounts an investment made one year from today, and its second example keeps the initial cost outside the function as =NPV(rate, returns) + initial cost.
The calculator's "First cash flow" setting covers both. "Today" (the default) is the second pattern, which is what most people mean. "End of period 1" reproduces Excel's NPV function applied to every value. The results panel always shows the other convention too, so if your spreadsheet disagrees with a colleague's you can see which one each of you used. The IRR is the same under both settings, because shifting every cash flow by one period doesn't change the rate at which their present values sum to zero.
How the IRR is found
There is no formula for the IRR of more than a few cash flows, so it has to be found by searching. The calculator does what Excel does: it starts at a guess (10% unless you change it) and applies Newton's method, which uses the slope of the NPV curve to jump towards the rate where the NPV is zero. If that doesn't settle, it scans rates from −99% upwards for a point where the NPV changes sign and narrows the interval by bisection.
Two situations need care. If every cash flow has the same sign there is no IRR, and the calculator says so instead of inventing one. If the cash flows change sign more than once, for example an investment followed by income and then a large cost at the end, the NPV curve can cross zero at more than one rate. The calculator reports the number of sign changes, returns the IRR nearest your guess, and lets you move the guess to look for others. In those cases the IRR is not a reliable guide on its own and the NPV at your chosen rate is the figure to rely on.
Dated cash flows: XNPV and XIRR
Real cash flows rarely arrive on neat anniversaries. Under the advanced options you can give a date for every cash flow, written as YYYY-MM-DD. The calculator then uses Excel's XNPV definition: each cash flow is discounted by (1 + r) raised to the number of days since the first date divided by 365, and the first date is the starting point. That Actual/365 day count is the default; the advanced options also offer Actual/360, the money-market convention, and Actual/Actual (ISDA), which divides the days that fall in a leap year by 366. The discount rate and the resulting XIRR are yearly rates. Microsoft's example of an investment of $10,000 on January 1, 2008, followed by four irregular payments, has an XNPV of $2,086.65 at 9% and an XIRR of about 37.34%; you can type those dates and amounts in to see the same figures.
Worked example with the default inputs
The calculator opens with Microsoft's second NPV example: an investment of $40,000 today returning $8,000, $9,200, $10,000, $12,000 and $14,500 over the next five years, discounted at 8%.
| Year | Cash flow | Discount factor at 8% | Present value |
|---|---|---|---|
| 0 | −$40,000 | 1.000000 | −$40,000.00 |
| 1 | $8,000 | 0.925926 | $7,407.41 |
| 2 | $9,200 | 0.857339 | $7,887.52 |
| 3 | $10,000 | 0.793832 | $7,938.32 |
| 4 | $12,000 | 0.735030 | $8,820.36 |
| 5 | $14,500 | 0.680583 | $9,868.46 |
The present values of the returns add up to $41,922.06, so the NPV is $41,922.06 − $40,000 = $1,922.06, the figure on Microsoft's help page. The profitability index is $41,922.06 ÷ $40,000 = 1.0481. Passing all six values to Excel's NPV function instead would give $1,779.69, because the $40,000 would be discounted by a year.
The IRR is 9.63%: at that rate the present value of the returns is exactly $40,000. Since 9.63% is above the 8% discount rate, the NPV is positive. The rate sensitivity table confirms it: the NPV is $4,471.70 at 6%, $1,922.06 at 8% and −$411.30 at 10%, crossing zero between the last two.
Undiscounted, the cash flows recover the $40,000 after 4.06 years: $39,200 has come back by the end of year 4, and the remaining $800 is 800 ÷ 14,500 = 0.06 of year 5. With discounted cash flows the payback takes 4.81 years. If you raise the discount rate to 12%, the NPV becomes −$2,551.25 and the discounted payback never arrives within the five years, which is what a negative NPV means in practice.
What the calculator leaves out
The cash flows are taken as given: the calculator doesn't add taxes, inflation, financing costs or the value of options to delay or abandon a project. It uses one discount rate for every period. It doesn't compute the modified IRR (MIRR), which assumes reinvestment at a rate you choose rather than at the IRR. Treat the result as a way to compare options at a consistent rate, not as a forecast. For the value of a level stream of payments, the present value calculator solves the annuity equation directly, and the ROI calculator gives a simpler return figure when timing matters less.
More questions
Should I enter the initial investment as a negative number?
Yes. Money that leaves your pocket (the purchase price, a renovation, a later clean-up cost) is negative and money that comes back is positive. The calculator needs at least one of each to find an IRR. If you type every amount as positive, it will report a large positive NPV and no IRR, which is a sign the signs are wrong.
Can I use monthly cash flows?
Yes. Enter one value per month and use a monthly discount rate, such as 8% ÷ 12 = 0.667% for a nominal 8% a year. The IRR is then a monthly rate too; (1 + monthly IRR)¹² − 1 converts it to an effective yearly rate. Alternatively enter a date for every cash flow and the calculator switches to XNPV and XIRR with a yearly rate.
Why can the IRR and NPV rank two projects differently?
NPV measures value in dollars at your discount rate, while IRR is a percentage that ignores the size of the project and assumes cash can be reinvested at the IRR itself. A small project can have a higher IRR but add fewer dollars than a large one. When the two disagree, finance textbooks and most corporate finance teams follow NPV.
What happens if a cash flow is zero?
Type 0 for that period so the later cash flows keep their correct position in time. Leaving a period out entirely shifts every later cash flow one period earlier, which raises its present value and makes the project look better than it is.
How precise is the IRR?
The search stops when the rate changes by less than one part in a trillion between steps, then the result is rounded to six decimal places of a percent. That is more precise than Excel's display, which typically shows the IRR to one or two decimals, so small differences in the last digits are rounding only.
Does the calculator handle a discount rate that changes over time?
No, it uses one rate for every period. To use different rates, discount each period's cash flow yourself with the product of the yearly factors, or split the project into stages and value each stage separately.
Sources
This article explains how the calculator works and is general information, not financial, tax, legal or medical advice. Rules change; check the sources above or a qualified professional before you act.