Menu

NPV and IRR in Excel: Formulas and the Year 0 Trap

=NPV(E2,B3:B5)+B2 discounts the future cash flows at the rate in E2 and adds the initial investment in B2, which NPV must not discount. =IRR(B2:B5) returns the rate at which that NPV is zero. XNPV and XIRR take real dates.

Every sheet on this page is live: change a number or a formula and it recalculates.

=NPV(E2,B3:B5)+B2 discounts the cash flows of years 1 to 3 at the rate in E2 and adds the initial investment in B2, which is not discounted because it happens today. =IRR(B2:B5) returns the discount rate at which that net present value is exactly zero.

NPV and IRR of a project
E3
ABCDE
1YearCash flowMeasureValue
20-$10,000Rate10%
31$3,000NPV$1,307.29
42$4,200IRR16.34%
53$6,800
Click a cell to see its formula. Change a number or a formula and the sheet recalculates.

At 10% the project is worth 1,307.29 more than it costs, and its IRR is about 16.34%. Change the rate in E2 to 16% and the NPV falls to about 64; at 20% it turns negative. That is the link between the two: IRR is the rate where NPV crosses zero.

NPV syntax: the first cash flow is one period away

=NPV(rate, value1, [value2], ...)

Excel's NPV assumes every value is at the end of a period, starting one period from now. So the first value in the range is discounted once, the second twice, and so on. An investment made today (year 0) must not be in the range: add it after NPV, as the formula above does. The investment is negative because it is money going out.

Putting it inside the range is the most common NPV mistake in Excel, and it does not show an error, just a smaller number:

Initial investment inside vs outside NPV
E3
ABCDE
1YearCash flowVersionNPV at 10%
20-$10,000Rate10%
31$3,000Right$1,307.29
42$4,200Wrong$1,188.44
53$6,800
Click a cell to see its formula. Change a number or a formula and the sheet recalculates.

The wrong version gives 1,188.44, which is the right answer divided by 1.1: every flow, the investment included, has been pushed one year later. If the first cash flow really is at the end of year 1 (you pay for the machine a year from now), then the whole range belongs inside NPV.

How NPV is calculated

NPV divides each cash flow by (1 + rate) raised to its year and adds the results. This sheet does it by hand, so you can see what each year contributes.

Discounting each year
C3
ABCDE
1YearCash flowPresent valueRate
20-$10,000.00-$10,000.0010%
31$3,000.00$2,727.27
42$4,200.00$3,471.07
53$6,800.00$5,108.94
6Total$1,307.29
Click a cell to see its formula. Change a number or a formula and the sheet recalculates.

The 6,800 of year 3 is worth only 5,108.94 today at 10%. The total in C6 is the same 1,307.29 as NPV gave. Year 0 is divided by (1.1)^0, which is 1, so it stays as it is.

IRR syntax and how to read it

=IRR(values, [guess])

values holds every cash flow in time order, the negative investment first. They must be evenly spaced (every year, or every month). guess is an optional starting point for Excel's search, 10% by default; give one only when IRR returns #NUM!.

A project is worth doing when its IRR is higher than the rate your money costs or could earn elsewhere (the hurdle rate). An IRR of 16.34% against a 10% cost of capital is a yes, which matches the positive NPV.

If the cash flows are monthly, IRR returns a monthly rate. Convert it to a yearly rate with =(1+IRR(B2:B13))^12-1, not by multiplying by 12.

IRR returns #NUM! when all the values have the same sign (there is no investment to earn back) or when it cannot find a rate in 20 tries. A series that changes sign more than once (invest, earn, invest again) can have two valid IRRs; which one Excel returns depends on the guess, which is a reason to trust NPV more in that case.

XNPV and XIRR for real dates

When cash flows do not fall on regular dates, use XNPV and XIRR. They take a date for each value and discount by the exact number of days, on a 365 day year. Unlike NPV, XNPV discounts every value back to the first date and leaves the first value undiscounted, so the investment goes inside the range.

Irregular dates
E2
ABCDE
1DateCash flowMeasureValue
22026-01-15-$10,000XNPV at 10%$1,609.73
32026-09-01$3,000XIRR19.08%
42027-06-30$4,200
52028-12-31$6,800
Click a cell to see its formula. Change a number or a formula and the sheet recalculates.

XNPV comes out higher than the yearly NPV because every cash flow arrives earlier than a whole number of years: the first 3,000 after seven and a half months, the last 6,800 two weeks before the end of year 3. Move the last date a year later and both results drop: the same money arriving later is worth less today. XIRR is also the right function for the return on an investment account with deposits on random days.

Try it: NPV and IRR

Should we buy the van?
E3
ABCDE
1YearCash flowMeasureValue
20-$24,000Rate8%
31$7,000NPV
42$7,500
53$8,000
64$8,500
Click a cell to see its formula. Change a number or a formula and the sheet recalculates.

Your turn: The van costs B2 today and saves the amounts in B3:B6 at the end of years 1 to 4. In E3, calculate the net present value at the rate in E2.

Hint: year 0 stays outside NPV.

Return on a small rental
E2
ABCDE
1YearCash flowMeasureValue
20-$50,000IRR
31$9,000
42$9,500
53$10,000
64$10,500
75$25,000
Click a cell to see its formula. Change a number or a formula and the sheet recalculates.

Your turn: In E2, calculate the internal rate of return of the cash flows in B2:B7.

NPV vs IRR: which one to trust

QuestionUseWhy
Is this project worth it at our cost of capital?NPVA positive NPV adds that much value in today's money.
What return does this project make?IRROne percentage, easy to compare with a hurdle rate.
Which of two projects of different size?NPVIRR favours small projects: 50% on 1,000 is less money than 20% on 100,000.
Cash flows that change sign more than onceNPVIRR can have two answers or none.
Payments on irregular datesXNPV / XIRRNPV and IRR assume equal periods.

For a single growth rate between a start and an end value, with nothing in between, CAGR is simpler than IRR. For loan payments use PMT.

Frequently Asked Questions

How do I calculate NPV in Excel?

Use =NPV(rate, future cash flows) + initial investment, for example =NPV(10%,B3:B5)+B2 with the investment in B2 entered as a negative number. NPV treats its first value as arriving one period from now, so the money spent today must stay outside it.

Why does Excel's NPV give a different answer from my calculator?

Usually because the initial investment was put inside the range: =NPV(10%,B2:B5) discounts the year 0 amount by one year too. Excel's NPV is the present value one period before the first cash flow, not a finance-textbook NPV with a time 0 value.

How do I calculate IRR in Excel?

Put all cash flows, including the negative initial investment, in one range and use =IRR(B2:B5). The flows must be evenly spaced; for real dates use =XIRR(values, dates).

Why does IRR return #NUM! in Excel?

Either every cash flow has the same sign (there is no rate at which they cancel out) or Excel did not find a rate within 20 tries. Check that the investment is negative, then give a guess as the second argument: =IRR(B2:B5,0.1).

What is the difference between NPV and XNPV?

NPV assumes equal periods between cash flows and that the first one comes after one period. XNPV takes a date for each cash flow, discounts by the exact number of days, and discounts everything back to the first date, so the investment goes inside the range.

Coddy programming languages illustration

Learn to code with Coddy

GET STARTED