Skip to content

Step-by-step, with a worked example

How to Calculate XIRR in Excel and Google Sheets

Both Excel and Google Sheets have a built-in XIRR() function that calculates exactly the same annualised return as the free tool on this site. This page walks through the exact steps, a worked example you can type in and check, and fixes for the #NUM! error that trips up most first attempts.

The XIRR() function syntax

Both spreadsheets use the same syntax: XIRR(values, dates, guess). The third argument, guess, is optional in both and rarely needed.

Worked example: type this in and check your own result

Set up three cash flows in two columns, amount and date, exactly as below.

Cell (amount)ValueCell (date)Value
A1-100000B101-Jan-2022
A2-100000B201-Jan-2023
A3250000B301-Jan-2024

In an empty cell, type =XIRR(A1:A3,B1:B3) and format the result as a percentage. This should return approximately 15.83 percent. If you get exactly this figure, your formula and date formatting are both correct; you can cross-check the same three cash flows in the XIRR calculator's irregular cash flows mode, entering the two -100000 rows as Investment and the 250000 row as Withdrawal / value received.

Why the result might not be a whole, round number

XIRR's day-count convention is exact calendar days divided by 365, not a rounded number of years. Two cash flows exactly one calendar year apart, when that year includes 29 February, span 366 days rather than 365, which slightly changes the discounting compared to a non-leap year. This is expected behaviour, not a formula error, and both Excel and Google Sheets, and this site's calculator, use the identical convention, so results between them should always match exactly for the same inputs.

Fixing the #NUM! error

A #NUM! result from XIRR() almost always comes down to one of these:

Adding a new transaction to a running log without breaking the formula

If you keep a running log of every SIP instalment, top-up and withdrawal in two columns, the amounts range and the dates range must always stay exactly the same length as each other, with no extra blank rows on either side. A range padded with blank rows for future transactions, for example =XIRR(A1:A200,B1:B200) when only 40 rows have data so far, is a common source of a #NUM! error: an uneven or blank-padded pair can derail the solver even though it looks harmless. Reselecting the two ranges each time a row is added, so both stop at the same last populated row, is the safest habit.

A shortcut if you would rather skip the spreadsheet

If you only need the answer and not a reusable spreadsheet, the XIRR calculator on this site's homepage solves the identical equation without opening Excel or Google Sheets at all: choose regular investments for a fixed SIP schedule, or irregular cash flows to enter transactions exactly as you would in a spreadsheet's two columns. See XIRR vs CAGR if you are trying to decide which metric your comparison actually needs, and the privacy policy for how your entered numbers are handled (they are not sent to a server, in either tool).

Frequently asked questions

Does Google Sheets' XIRR() give the same answer as Excel's?
Yes. Both implement the same days-divided-by-365 convention and the same underlying equation, so identical inputs produce identical results in both, and both should also match this site's calculator.
Can I use XIRR() with only two cash flows?
Yes, as long as one is negative and one is positive. With exactly two cash flows, XIRR gives the same result as a CAGR calculation over the same two dates.
What does the optional guess argument actually do?
It gives the function's internal solver a starting point to search from. The default guess (10 percent) works for the vast majority of real cash flow sets; it is only worth supplying your own guess if the function returns a #NUM! error without one.
My dates are in a different format, will that break XIRR()?
As long as the cell is recognised by your spreadsheet as an actual date value (not text), the display format, such as DD/MM/YYYY versus MM/DD/YYYY, does not affect the calculation itself.

Skip the spreadsheet entirely

Get the same XIRR result in seconds, no formulas required.

Go to the XIRR calculator

Free. No sign-up.