Sub topic 12
Using XIRR
This chapter assumes you can enter formulas and dates in Excel and that you know what NPV and IRR measure. It also assumes you have seen XNPV, which XIRR builds on. By the end you should be able to build an XIRR calculation, state its day-count basis, and check the result.
What XIRR does
XIRR returns the annualized internal rate of return for cash flows that fall on specific dates. It finds the rate at which XNPV equals zero. IRR assumes equally spaced periods and returns a rate per period. XIRR takes the actual dates and returns an annual rate.
The syntax is:
=XIRR(values, dates, [guess])valuesis the range of cash flows. It must contain at least one negative and one positive value.datesis the range of dates for those cash flows. Each date pairs with the value in the same position.guessis optional. It is the starting rate for the solver, and the default is 10%.
The first date is the start of the timeline. XIRR discounts every cash flow by the number of days since that first date, divided by 365. The other dates may appear in any order, but none may fall before the first date.
A worked example
A fund invests money in stages and receives distributions later. Put the dates in A2:A6 as real Excel dates, not text, and the cash flows in B2:B6.
| Cell | Date | Cash flow |
|---|---|---|
| A2/B2 | 2024-01-15 | -10,000 |
| A3/B3 | 2024-06-30 | -2,000 |
| A4/B4 | 2025-03-31 | 3,500 |
| A5/B5 | 2025-12-31 | 4,500 |
| A6/B6 | 2026-06-30 | 6,000 |
Use these formulas:
A2:A6 hold dates, B2:B6 hold cash flows (at least one negative and one positive)
XIRR with the default starting guess:
=XIRR(B2:B6, A2:A6)
XIRR with an explicit guess:
=XIRR(B2:B6, A2:A6, 0.1)
Check that XNPV at the XIRR is approximately zero:
=XNPV(XIRR(B2:B6, A2:A6), B2:B6, A2:A6)The first formula returns the annual rate. The second gives the solver a starting point of 10%. For a well-behaved series like this one, both return the same answer. The third formula is a cross-check. XNPV evaluated at the XIRR should be very close to zero, such as a few thousandths of a currency unit or less.
Format the XIRR cell as a percentage. XIRR returns a decimal, so 0.1423 displays as 14.23%.
How the calculation works
XIRR solves this equation for the rate r:
0 = sum over i of CFi / (1 + r)^((di - d_1) / 365)
Here CFi is the cash flow on date di, and d_1 is the first date. The exponent is the elapsed time in years, counted as actual days divided by 365. Because the rate is an effective annual rate, you can compare an XIRR directly with another annual effective rate.
You can reproduce the XNPV side of the check without the XNPV function:
A2:A6 hold real Excel dates (not text), B2:B6 hold cash flows
D1: Discount rate = 10%
XNPV:
=XNPV(D1, B2:B6, A2:A6)
Manual check using the same 365-day basis:
=SUMPRODUCT(B2:B6 / (1 + D1)^((A2:A6 - A2) / 365))If the two results match, your dates and values are being read the way you intended. Replace D1 with the XIRR result and the value should be near zero.
The 365-day basis
XIRR always divides days by 365, including in leap years. A cash flow 366 days after the start is discounted for 366/365 years, which is slightly more than one year. This is a convention, not an error. It matters when you compare against a tool that uses actual/actual or 360-day counting. In that case the two annual rates can differ in the second or third decimal place of the percentage.
How the solver finds the rate
XIRR uses an iterative method. It starts at the guess, evaluates the equation, adjusts the rate, and repeats until the result is accurate to about 0.000001 percent. If it has not converged after 100 iterations, it returns #NUM!.
The default guess works for most conventional cash flows, where there is one negative flow followed by positives. A different guess can help when:
- The true rate is far from 10%, such as a return of several hundred percent or a deep loss.
- The cash flows have unusual timing, such as a very large flow very late.
- XIRR returns
#NUM!for a series you know has a solution.
Try a few starting points, such as 0.01, 0.5, and -0.5. If different guesses return different answers, the series probably has more than one solution (see below).
Errors and what they mean
| Result | Likely cause | Fix |
|---|---|---|
| `#NUM!` | All values have the same sign | Check that you have both an outflow and an inflow |
| `#NUM!` | A date before the first date | Put the earliest date first, or sort the data so it starts there |
| `#NUM!` | No convergence in 100 iterations | Supply a different guess |
| `#VALUE!` | Dates stored as text | Convert them to real dates, for example with `DATEVALUE` |
| `#VALUE!` | A date is not a valid date | Correct the entry |
| `#NUM!` | The values and dates ranges differ in size | Make both ranges the same length |
Two problems are easy to miss because XIRR may still return a number:
- Dates stored as numbers with the wrong meaning. Check the cell format. A date such as 45306 is valid but may not be the date you meant.
- Blank or zero rows. A blank in the values range can cause an error in some versions of Excel. Zero values are safe, but a blank row inside the range is better removed.
Dates are truncated to integers. A time of day in a date cell is ignored.
XIRR and the t=0 cash flow
NPV treats its first value as one period away, which forces you to add the t=0 flow outside the function. XIRR has no such problem. The first date is the origin of the timeline, so the first cash flow sits at time zero and is not discounted. You include it in the range.
That is the main structural difference to remember:
| Function | Is the first value discounted? | First cash flow goes... |
|---|---|---|
| NPV | Yes, by one period | Outside the function |
| XNPV | No | Inside the range |
| IRR | No, the first value is at t=0 | Inside the range |
| XIRR | No | Inside the range |
Limits that carry over from IRR
XIRR inherits the weaknesses of IRR.
- Multiple solutions. If the signs of the cash flows change more than once, such as an outflow, inflows, then a closing outflow, there may be more than one rate that sets XNPV to zero. XIRR returns whichever one the solver reaches first.
- Reinvestment assumption. XIRR implicitly assumes interim cash flows are reinvested at the XIRR itself. A very high XIRR is therefore a weak claim about what an investor actually earns.
- Scale. XIRR is a rate, not an amount. A small project with a high rate may add less value than a large project with a lower rate.
To see whether your series has a single clear answer, build an NPV profile. Compute XNPV at rates from, say, -20% to 100%, and see where the line crosses zero. One crossing means the XIRR is unambiguous. Several crossings mean you should report XNPV, or use MIRR on a periodic series, instead.
Building XIRR into a model
- Keep dates and cash flows in adjacent columns, with the first row as the start date.
- Use one sign convention: outflows negative, inflows positive.
- Store dates as real dates and format them consistently.
- Place the discount rate and any guess in labeled input cells, not inside formulas.
- Add a check cell that computes XNPV at the XIRR and flags it if the absolute value exceeds a tolerance, for example
=IF(ABS(XNPV(E1,B2:B6,A2:A6))<0.01,"OK","CHECK"), where E1 holds the XIRR. - Compare with XNPV at your required rate. If XNPV is positive at the hurdle rate, XIRR should be above it.
Exercises
Exercise
A series has dates 2025-01-01, 2025-07-01, and 2026-01-01 with cash flows of -5,000, 1,000, and 5,000. You write =XIRR(B2:B4, A2:A4) and get #VALUE!. The dates look correct and are left-aligned. What is the most likely cause, and how do you check it?
Show answer
The dates are probably stored as text, which is why they are left-aligned. Check with =ISNUMBER(A2). If it returns FALSE, convert the cells to real dates, for example with =DATEVALUE(A2) or by re-entering them, and then rerun XIRR.
Exercise
You compute XIRR for a project and get 18%. How would you verify the result using XNPV, and what value should you expect?
Show answer
Compute =XNPV(XIRR(B2:B6, A2:A6), B2:B6, A2:A6). The result should be approximately zero, within a small rounding tolerance, because XIRR is defined as the rate that sets XNPV to zero.
Exercise
A cash flow series with signs -, +, +, - returns different XIRR values when you use guesses of 0.05 and 0.8. What does this tell you, and what should you do?
Show answer
The series changes sign twice, so it probably has more than one rate at which XNPV is zero. The result depends on the starting guess. Build an NPV profile by calculating XNPV across a range of rates to see the crossings, and base the decision on XNPV at your required rate, or on MIRR for periodic data.