Benchmarking and allocation

How to compare your stock portfolio with Nifty 50 using XIRR

A step-by-step Google Sheets method to compare your real return with the Nifty 50 Total Return Index, counting every deposit and withdrawal on its date.

Your broker app says you are up 20%. Is that good? It depends on how long it took, when you added money, and what you would have earned by simply holding the index instead. This guide walks you through a Google Sheets method that answers all three: your portfolio’s annual return counting every deposit and withdrawal on its date, and the return the same cash would have earned in the Nifty 50 Total Return Index.

Why “up 20%” tells you very little

The gain your broker shows is usually current value minus what you paid. It ignores time: 20% over six months and 20% over five years are very different results. It also ignores timing: money you added last month has had no chance to grow, but it sits in the same total as money invested years ago.

XIRR fixes both. It finds the single yearly rate of return that, applied to every rupee from the day it went in to the day it came out (or today), produces your actual result. It is the standard way to measure returns when money goes in and out at irregular times, and both Google Sheets and Excel have it built in.

Why the benchmark must be the Total Return Index

The Nifty 50 figure you see quoted every day is a price index. It does not include dividends. Your portfolio does receive dividends, so comparing it with the price index flatters you. The Nifty 50 Total Return Index (TRI) assumes dividends are reinvested, which makes it the fair comparison. NSE Indices publishes TRI values on its historical data page, where you can choose the index, the Total Returns Index option and a date range.

Step 1: List your cash flows

First decide what counts as “the portfolio”. The simplest, most honest boundary is your trading account: money you transferred in, money you withdrew, and what the account is worth today. That way idle cash in the account is counted, and you do not have to list every purchase.

  1. In a new sheet, put dates in column A and amounts in column B.
  2. Enter every transfer into the trading account as a negative number, on the date it happened. This is money leaving your pocket.
  3. Enter every withdrawal out of the account as a positive number.
  4. Add each dividend as a positive number on its payment date. In India, dividends on shares are paid to the bank account registered with your demat, not into the trading account, so they have left the portfolio and must be counted here. Your bank statement shows each one; many brokers also have a dividend report.
  5. On the last row, enter today’s date and the account’s current value (holdings plus any cash) as a positive number, as if you sold everything today.
  6. In an empty cell, type =XIRR(B2:B10,A2:A10), adjusting the range to your rows, and format it as a percentage. Google’s XIRR help page notes that the amounts need at least one negative and one positive value. Also make sure the dates are real dates, not text.

Your bank statement or your broker’s funds ledger has the transfer dates. If you have used the account for many years, start from a date you can reconstruct, and use the account value on that date as your first, negative cash flow.

Step 2: Build the same cash flows in the index

Now pretend every rupee you moved went into the Nifty 50 TRI instead. You do this by converting each cash flow into index “units”.

  1. Download Nifty 50 TRI values covering your dates from NSE Indices.
  2. In column C, next to each cash flow, put the TRI value on that date (or the nearest trading day before it).
  3. In column D, work out units: =-B2/C2 for each row except the last. A deposit (negative amount) buys positive units; a withdrawal (positive amount) sells units.
  4. Add up all the units. Multiply the total by today’s TRI value. That is what the index version of your account would be worth now.
  5. Copy your cash-flow column, replace the final value with the index version’s value, and run XIRR on it. That is the benchmark’s return on your exact cash flows.
Worked example (the index values are illustrative, not real)

Cash flows into and out of a trading account:

DateCash flowTRI (illustrative)Index units
15 Jan 2024−₹2,00,00030,000+6.6667
10 Jul 2024−₹1,00,00033,000+3.0303
5 Feb 2025+₹50,00034,000−1.4706
20 Oct 2026+₹3,10,00039,0008.2264 held
  • Money in: ₹3,00,000. Money out plus value today: ₹3,60,000. A gain of ₹60,000, or 20% on what went in.
  • Portfolio XIRR: about 8.1% a year.
  • Index version: 8.2264 units × 39,000 = ₹3,20,829. Its XIRR on the same dates: about 9.4% a year.

The 20% gain looks healthy. Spread over nearly three years, with money arriving at different times, it is about 8.1% a year, and simply holding the index would have earned about 9.4% on the same cash. That difference, about 1.3 percentage points a year, is what your stock choices added or cost.

What counts as a cash flow, and what does not

Bonus issues, stock splits and mergers change your share count but not your money, so they do not belong in the cash-flow column; the account value at the end already reflects them. Dividends paid into your trading account would stay inside the boundary, but in India they are normally paid straight to your bank account, so enter each one as a positive cash flow on its payment date (step 4 above), or your return will look lower than it was.

Reading your result

  • Your XIRR is higher. Your stocks did better than the index on your cash flows over this period. Check how much of that came from one or two holdings; the concentration calculator shows how heavily you depend on them.
  • Your XIRR is lower. Holding the index would have done better on the same cash over this period.
  • They are close. You have taken on the work and the concentration of picking stocks for roughly an index return.

Choosing the right benchmark

Nifty 50 contains large companies only. If your portfolio is mostly mid and small companies, comparing it with Nifty 50 mixes two things: your stock choices and the different behaviour of smaller companies. NSE Indices also publishes TRI values for broader and size-based indices such as the Nifty 500, Nifty Midcap 150 and Nifty Smallcap 250. Pick the one closest to what you actually hold; the guide to your large, mid and small cap mix shows how to check that.

How this differs from the comparison on Portfo’s home page

The example on Portfo’s home page compares price movement over a year using today’s quantities. It answers “how did the stocks I hold now move against Nifty 50?” XIRR answers a different question: “what return did my money actually earn, given when I added and withdrew it?” Both are useful. Only XIRR reflects your real experience as an investor.

Limits of this approach

  • Short periods exaggerate. XIRR annualises. A 5% gain over two months becomes a large yearly figure. Treat anything under a year with caution.
  • Costs and taxes. Your account value is after brokerage and charges; the index has none. Tax on gains is outside both unless you count tax payments as withdrawals.
  • The past only. A few years of beating or trailing the index says little about the next few.
  • Data care. One wrong sign or a date entered as text breaks XIRR. If you get an error, check that deposits are negative, the final value is positive, and every date is a real date.

The short version

List every deposit as a negative number and every withdrawal plus today’s value as positive numbers, with dates, and run XIRR. Then convert the same cash flows into Nifty 50 TRI units, value them today, and run XIRR again. The gap between the two numbers is the honest answer to “how am I doing?”

Check your whole portfolio

When the app opens, Portfo runs these checks for you every month, read-only.

Free. No stock tips.

Sources

  1. Google Docs Editors Help: XIRR
  2. NSE Indices: Historical data (Total Returns Index)

Get the full health check when the app opens

When the app opens, Portfo will connect to your broker read-only, check your stocks every month and explain what changed. Join the list and we’ll email you the download link.

Portfo

Get the download link

The health check is free. Leave your email and we’ll send the download link when it opens.

We’ll only use your email for Portfo launch updates. Unsubscribe anytime. See our privacy policy.