Home › Blogs › IRR, XIRR and NPV in Excel
Business Software

IRR, XIRR and NPV in Excel: The Formulas and Their Traps

Excel’s NPV function does not do what its name suggests. It discounts every value you give it, including the first one, as if each cash flow arrived at the end of a period. Put today’s investment inside the range and the answer is quietly wrong. The fix is to keep the initial outlay outside the function and add it separately.

That one behaviour causes more wrong project appraisals than any other spreadsheet error. The same spreadsheet habits also break IRR and XIRR in predictable ways. Everything below works identically in Google Sheets.

Key takeaways
  • Excel’s NPV treats its first value as arriving at the end of period one. Keep today’s outlay outside: =B2+NPV(rate,B3:Bn), or use XNPV.
  • In this article’s example, the correct NPV at 10% is about −₹49,040; putting the outlay inside NPV gives about −₹44,582, the right answer divided by 1.10.
  • IRR assumes every row is one equal period. On monthly rows, 1.20% a month is about 15.45% a year effective, not 1.2% a year.
  • Use XIRR and XNPV whenever cash flows have real, uneven dates; both measure time in days on a 365-day year.
  • Most #NUM! errors come from same-sign flows, a missing closing value, blank cells, dates stored as text, or more than one sign change.

The example used throughout

A business is considering a machine that costs ₹10,00,000 today and is expected to generate ₹3,00,000 at the end of each of the next four years. The required return is 10%.

CellYearCash flow ₹
B20−10,00,000
B313,00,000
B423,00,000
B533,00,000
B643,00,000

NPV: the wrong way and the right way

Wrong: =NPV(10%, B2:B6) returns about −44,582.

Excel treats B2 as arriving at the end of year one and discounts it by 10%, then pushes every later flow one year further out than it really is.

Right: =B2 + NPV(10%, B3:B6) returns about −49,040.

The present value of four ₹3,00,000 inflows at 10% is ₹9,50,960. Subtract the ₹10,00,000 paid today and the project destroys ₹49,040 of value at a 10% hurdle rate.

The wrong version is exactly the right answer divided by 1.10: every flow has been discounted one period too many. That means it never flips a positive NPV to negative or the reverse, and at the same rate it will not change which of two projects ranks higher. So the mistake survives review, because the decision still looks sensible.

Where it does damage is in rupees. If the NPV feeds a valuation, a comparison with the price you are being asked to pay, or a sum with figures computed correctly elsewhere, its size is shrunk by a whole period of the discount rate: a positive NPV looks smaller than it is, and a negative NPV looks less bad, as in the example above. On a large project at a 12% hurdle that is a large number to get wrong.

The rule to remember: NPV’s first argument after the rate is the end of period one, not today.

Bar chart: correct NPV of −₹49,040 against −₹44,582 from the wrong formula at 10%, and ₹39,532 against ₹37,294 at 6%
Same sign, smaller size: why the off-by-one survives review.

IRR: periods, not dates

=IRR(B2:B6) returns about 7.71%, below the 10% hurdle, consistent with the negative NPV.

IRR has no such off-by-one problem, because it includes the first flow at time zero. Its assumption is different: every cash flow is exactly one period apart. The period is whatever your rows represent.

That matters when the rows are months. A loan or investment of ₹5,00,000 repaid in twelve monthly instalments of ₹45,000 gives =IRR(...) of about 1.20%. That is a monthly rate. It is not 1.2% a year.

  • Multiplying by twelve gives 14.45%, the nominal annual rate.
  • Compounding, =(1+1.2043%)^12−1, gives 15.45%, the effective annual rate.

Which one you report depends on what you are comparing against, but reporting 1.2% as though it were annual is a mistake that shows up in real proposals more often than it should.

NPV at different rates, and a check on IRR

Putting NPV at several rates side by side shows how IRR and NPV fit together. With the rates in A10:A17, enter =$B$2+NPV(A10,$B$3:$B$6) in B10 and copy it down:

Discount rateNPV of the machine
0%₹2,00,000
2%₹1,42,319
4%₹88,969
6%₹39,532
8%−₹6,362
10%−₹49,040
12%−₹88,795
14%−₹1,25,886

NPV falls as the rate rises and crosses zero between 6% and 8%. The exact crossing point, about 7.71%, is the IRR. That gives a simple check on any IRR result: =B2+NPV(IRR(B2:B6),B3:B6) should return zero, give or take a rounding fraction. If it does not, the ranges in the two formulas do not match.

It also shows why NPV and IRR agree on whether to accept a conventional project like this one: NPV is positive at any hurdle below 7.71% and negative at any hurdle above it. They can still rank two competing projects differently, which is covered in IRR conflicts and MIRR.

Line chart: NPV of the machine falls from ₹2 lakh at 0% to below zero after about 7.7%, crossing zero at the IRR
IRR is the discount rate at which NPV is exactly zero.

XIRR: when the dates are uneven

Real cash flows rarely arrive on neat anniversaries. SIP instalments skip a holiday, a customer pays three weeks late, a top-up happens mid-year. For those, use =XIRR(values, dates).

XIRR works from the actual dates, measures time from the first date in days, and expresses the result as an annual rate on a 365-day year. It is the right function for personal portfolio returns, which is why XIRR, not CAGR, is the honest measure of a SIP.

Its companion =XNPV(rate, values, dates) does what most people expect NPV to do: the first cash flow is not discounted, and every later flow is discounted by its actual distance from the first date. If your flows have dates, XNPV avoids the NPV off-by-one trap entirely.

A worked XIRR example

An investor puts ₹1,00,000 into a portfolio on 3 April 2025, adds ₹50,000 on 21 July and another ₹50,000 on 14 November, and ₹25,000 on 9 February 2026. On 31 March 2026 the portfolio is worth ₹2,48,000.

CellDateCellAmount ₹
A23 Apr 2025B2−1,00,000
A321 Jul 2025B3−50,000
A414 Nov 2025B4−50,000
A59 Feb 2026B5−25,000
A631 Mar 2026B62,48,000
  • =XIRR(B2:B6, A2:A6) returns about 14.91%, an annual rate. The money invested was ₹2,25,000 in total, but much of it was in the portfolio for only part of the year, which is why the rate is well above the simple gain of about 10%.
  • =XNPV(10%, B2:B6, A2:A6) returns about ₹6,843. It is positive because the portfolio earned more than 10% a year; at the XIRR rate it would be zero.
  • =IRR(B2:B6) returns about 3.28%. It treats the five rows as five equal periods and ignores the dates, so the figure means nothing here.

Note the signs: money paid in is negative, and the closing value is entered as a positive flow on the valuation date, exactly as the error list below explains. Figures are illustrative.

Three figures: XIRR of 14.91%, XNPV at 10% of ₹6,843, and a misleading IRR of 3.28% on the same uneven cash flows
With real dates, XIRR and XNPV are the right tools; IRR is not.

The five errors behind most wrong answers

  1. All cash flows with the same sign. IRR and XIRR need at least one negative and one positive value. Enter everything as positive and you get an error, not a return.
  2. Missing closing value. A portfolio return needs today’s value entered as a final positive flow on today’s date. Without it there is nothing to solve against.
  3. Blank cells in an IRR range. A skipped year should be a zero, not an empty cell. IRR ignores blanks, which silently shortens the timeline.
  4. Dates stored as text. XIRR needs real dates. A date typed in a format the spreadsheet did not recognise is text, and the function fails or misreads it. Check alignment: real dates usually sit right-aligned.
  5. More than one sign change. A project that costs money, earns, then costs money again for decommissioning can have two mathematically valid IRRs. The function returns one of them, depending on the guess. Use NPV at your required rate for these instead of relying on IRR.

When the function returns an error

An #NUM! from IRR or XIRR usually means it could not converge. Check the signs first. If the signs are right, supply a guess close to the answer you expect, for example =XIRR(B2:B20, A2:A20, 0.1). If it still fails, the cash flows may genuinely have no real rate of return, or more than one.

A layout that avoids most of this

  • Column A: dates. Column B: amounts, with money you pay out negative and money you receive positive.
  • Put the discount rate in its own labelled cell and refer to it, rather than typing 10% inside formulas.
  • Compute NPV as =B2+NPV(rate, B3:Bn) or use XNPV, and put a comment on the cell saying which.
  • Next to any IRR computed on monthly rows, show the annualised figure explicitly.

Frequently asked questions

Why is my Excel NPV different from my financial calculator’s?

Most likely the initial investment is inside Excel’s NPV range, so it has been discounted one period. Use =B2+NPV(rate,B3:Bn), or XNPV with dates, and the two should agree.

What is the difference between IRR and XIRR in Excel?

IRR assumes every cash flow is one equal period apart and returns a rate per period. XIRR uses the actual dates and returns an annual rate on a 365-day year.

How do I convert a monthly IRR into an annual rate?

For the effective annual rate use =(1+monthly_rate)^12-1; a monthly IRR of 1.2043% becomes about 15.45%. Multiplying by 12 gives the nominal annual rate, about 14.45% here.

How can I check that an IRR result is right?

Discount the same cash flows at the IRR: =B2+NPV(IRR(B2:B6),B3:B6) should return zero, allowing for a tiny rounding difference.

Can NPV and IRR give different answers?

For a single conventional project they agree on accept or reject at the same hurdle rate. They can rank mutually exclusive projects differently, and with more than one sign change IRR can have several values, so rely on NPV in those cases.

Where this fits

General educational information. Function behaviour described here is standard in Microsoft Excel and Google Sheets; check your spreadsheet’s documentation for version-specific differences. Figures are illustrative.
Advertisement