Sub topic 17
Cross-checks and troubleshooting errors in your model
This chapter assumes you can already compute NPV, XNPV, IRR, and XIRR, and that you know the t=0 rule for NPV and the 365-day basis of XNPV and XIRR. It covers how to confirm that a result is right and how to find the cause when a function fails.
Why a result that looks plausible can still be wrong
Most NPV and IRR mistakes do not produce an error. A shifted period, a text date, or a wrong sign convention still returns a number, and the number looks reasonable. Checks that run independently of the function you are testing are the only reliable defense. An error value such as #NUM! is the easier case, because Excel at least tells you something is wrong.
Build a check block next to the calculation
Each function has an identity you can test with a second formula. Put these in a labeled block beside the model and keep them there.
Take the cash flows from earlier chapters: -10,000 at t=0, then 3,000, 4,000, 4,000, 3,000, discounted at 8%. The NPV is about 1,587.56 and the IRR is about 14.9%.
A1: Discount rate B1: 8%
B3:B7 hold the cash flows, B3 is the t=0 outflow
Result: =NPV(B1, B4:B7) + B3
Independent: =SUMPRODUCT(B3:B7 / (1 + B1)^(ROW(B3:B7) - ROW(B3)))
Difference: =ROUND(D3 - D4, 6)
Check passes: =ABS(D3 - D4) < 0.005
IRR: =IRR(B3:B7)
NPV at IRR: =NPV(IRR(B3:B7), B4:B7) + B3
IRR check: =ABS(NPV(IRR(B3:B7), B4:B7) + B3) < 0.01The SUMPRODUCT formula uses an exponent equal to the row offset from the first cash flow. It never calls NPV, so it does not share NPV's timing assumption. If the two disagree, one of them is applying a different period count than you intended.
For dated flows, compare XNPV with the manual 365-day formula, and test XIRR by feeding it back into XNPV:
A2:A6 are dates, B2:B6 are cash flows, D1 is the discount rate
XNPV: =XNPV(D1, B2:B6, A2:A6)
Manual: =SUMPRODUCT(B2:B6 / (1 + D1)^((A2:A6 - A2) / 365))
XIRR: =XIRR(B2:B6, A2:A6)
XNPV at XIRR: =XNPV(XIRR(B2:B6, A2:A6), B2:B6, A2:A6)The last cell should be close to zero. "Close" depends on the scale of your cash flows, so use an absolute tolerance on a cell, not an exact comparison with 0.
Structural checks on the inputs
Many failures come from the inputs. Add these tests before the calculation runs.
| Check | Formula idea | What it catches |
|---|---|---|
| Both signs present | `=AND(COUNTIF(B2:B6,"<0")>0, COUNTIF(B2:B6,">0")>0)` | `#NUM!` from all-positive or all-negative flows |
| Dates are numbers | `=COUNT(A2:A6) = ROWS(A2:A6)` | Dates stored as text |
| Values are numbers | `=COUNT(B2:B6) = ROWS(B2:B6)` | Numbers stored as text, stray labels |
| No date before the first | `=MIN(A2:A6) = A2` | `#NUM!` from `XNPV` and `XIRR` |
| Sign of first flow | `=B2 < 0` for an investment | A reversed sign convention |
| Sensible rate | `=AND(rate > -1, rate < 1)` | A percent typed as `8` instead of `8%` |
A cell that shows 8 in a rate field is a classic input error. Excel then discounts by 800%, and the NPV collapses toward the t=0 flow without any error message.
Errors and what they usually mean
Most error values come from a small set of causes.
#NUM!fromIRRorXIRR. The cash flows have no sign change, so no rate can make NPV zero. Otherwise the iterative solver did not converge.IRRmakes up to 20 attempts andXIRRup to 100. If the cash flows contain both signs, try a differentguess.#NUM!fromXNPVorXIRRwith dates. A date in the list is earlier than the first date. The first date is the base date, so it must not be later than any other.#VALUE!fromXNPVorXIRR. A date or value is not numeric. Dates imported from a CSV or typed as"2026-03-31"in quotes are often text.#VALUE!from theNPVorIRRfamily. A cell in the range holds an error or a non-numeric entry that the function cannot skip.#DIV/0!or a huge number. A discount rate of -100% divides by zero in the formula, and rates near it blow up.
The diagram summarizes the order in which to check.
Silent problems that return a number
These are more dangerous than errors, because nothing flags them.
Blank cells in NPV. NPV ignores empty cells in a reference. If a period has no cash flow and the cell is blank, the following flows are discounted one period too early. Enter 0 for periods with no cash flow, so every period occupies a cell.
XIRR that fails quietly. In some cases XIRR returns a value very close to zero, such as 2.98E-09, instead of an error. This often happens when the first cash flow is zero or when the solver has not found a root. Treat a rate near 0% on a project that clearly earns a return as a failure, then run the XNPV check. If XNPV at that rate is far from zero, the rate is wrong.
Dates with time parts. Both XNPV and XIRR truncate dates to whole days. Two timestamps on the same calendar day count as the same day.
Periodic versus annual rates. IRR on monthly flows returns a monthly rate. An annual rate requires =(1+IRR(B3:B38))^12-1. A model that labels the monthly rate "IRR" next to an annual hurdle rate compares unlike quantities.
Mixed bases. XNPV uses actual days over 365. Comparing it to NPV on annual flows gives small differences that come from leap years. That difference is expected and not a bug.
Helping the solver converge
When IRR or XIRR fails but the signs are fine, try these steps in order:
- Pass a
guessnear the answer you expect, such as0.1for 10%. Try a negative guess if the project loses money overall. - Build an NPV profile with a column of rates, as in the earlier chapter. The point where NPV crosses zero shows the root, and you can use it as the
guess. - If the profile crosses zero more than once, the cash flows have multiple IRRs and no guess fixes that. Use NPV, or MIRR with an explicit finance rate and reinvestment rate.
- Rescale or restructure extreme cash flows. A single huge terminal value can make the solver unstable.
A3:A13 hold rates 0%, 2%, ... 20%
In C3, fill down to C13:
=NPV($A3, $B$4:$B$7) + $B$3
Then retry with a guess near the sign change:
=XIRR(B2:B6, A2:A6, 0.15)A short checklist before you ship a model
- Every cash flow cell is numeric, including zeros for empty periods.
- Dates are real dates, and the first date is the earliest.
- The sign of each cash flow follows one convention.
- The discount rate is a rate per the same basis as the cash flows.
- Each NPV-type result has an independent
SUMPRODUCTcheck. - Each IRR-type result has an NPV-at-the-rate check within a tolerance.
- The model shows a visible pass or fail cell for each check.
Exercise
A model computes =XIRR(B2:B6, A2:A6) and returns 2.98E-09, although the project clearly earns a positive return. Name two things you would check and one formula you would use to confirm the rate is wrong.
Show answer
Check that the dates in A2:A6 are real dates and that the first cash flow in B2 is a nonzero outflow, since a zero first value or text dates can make XIRR fail. Also check that the data has both negative and positive values. To confirm the result is wrong, evaluate =XNPV(XIRR(B2:B6, A2:A6), B2:B6, A2:A6). If it is far from zero, the rate is not a root. Then retry with a guess such as =XIRR(B2:B6, A2:A6, 0.1).
Exercise
Your NPV model has a blank cell in period 3 because nothing is paid that year. The result is higher than expected. What happened, and how do you fix it?
Show answer
NPV ignores empty cells in a reference, so periods 4 and later are discounted one period too early, which raises the value. Enter 0 in the period 3 cell so that it counts as a period.