Investment portfolio tracker in Excel: stocks, ETFs and crypto in one place

An index fund here, a few shares there, a bit of bitcoin on an exchange: with several accounts it is easy to lose track. A portfolio spreadsheet collects every buy and sell and shows cost basis, gains and losses and how your money is split.

In short: one row per buy, sell or dividend. SUMIFS works out units and cost basis for each holding, and market value is units times a current price you type in. The template shows unrealized and realized gains, dividends and the split by asset class. No live prices and no investment advice.

You should know: SUMIF and absolute references.

Try it now

Six buys across three holdings. How many units of the World ETF do you own, and what did they cost on average?

Task All of these are buys. In E2, work out the cost of the purchase (units times price plus fees) and fill down to E7. Then for the holding in G2: total units in G3 with SUMIF, total cost basis in G4 and the average cost per unit in G5 (cost basis divided by units).

ABCDEFGH
1 Holding Units Price Fees Cost
2 World ETF 50 100 1 Holding World ETF
3 Sample Corp 30 80 5 Units
4 World ETF 20 105 1 Cost basis
5 Emerging ETF 100 30 1 Average cost
6 World ETF 10 108 1
7 Sample Corp 10 84 5
8
9

Download the portfolio tracker

The Portfolio sheet has room for 30 holdings with name, ticker or ISIN, asset class and current price. Next to them it calculates units, cost basis, average cost, market value, unrealized gain in amount and percent, realized gain, dividends and interest and the weight in the portfolio. Below is the split by asset class with a chart and a column for your own target split. The Transactions sheet takes 500 buys, sells and dividends, including fractions such as 0.05 bitcoin. Formulas are protected, it prints landscape on Letter paper, and there is no currency symbol, so it works in dollars or pounds.

Preview of the investment portfolio tracker in Excel: holdings with asset class, current price, units, cost basis, average cost, market value, unrealized and realized gain, dividends and weight, with the split by asset class belowEnlarge preview

Download the finished template

The finished Excel file investment-portfolio-template.xlsx, with sample rows and instructions, is free. All you need is a free account: no subscription, no payment details.

Figures, rates and sample data in the templates are as of 13 November 2026, without guarantee. Check that they still apply to you. The templates are mainly meant to show how to build this in Excel.

Create a free account and download the template Already have an account? Log in

What each column means

Portfolio columnCalculation
UnitsUnits bought minus units sold (SUMIFS)
Cost basisPrice plus fees of all buys, minus the cost of units sold
Average costCost basis / units
Market valueUnits × current price
UnrealizedMarket value minus cost basis, in amount and percent
RealizedSale proceeds minus fees minus the cost removed
Total gain/lossUnrealized + realized + dividends and interest

Build the tracker yourself

1. Transactions

One row per event: date, holding from a drop-down list of the names on the Portfolio sheet, type (buy, sell, dividend), units, price and fees. For a dividend, the amount goes in the price column. Enter rows in date order, because each sale works with the holding just before it.

2. Cost basis with the average cost method

For every row the sheet works out the units and cost before that row, with ranges that start fixed at the top and grow as you fill down:

=SUMIFS(K$5:K12,B$5:B12,B13)-SUMIFS(J$5:J12,B$5:B12,B13)

On a sale, cost is removed in proportion: =ROUND(I13*D13/H13,2), the cost before times units sold divided by units held. In the sample, the portfolio holds 70 units of the World ETF that cost 7,102 and sells 30. Cost removed: 3,043.71; realized gain at a price of 110 with a fee of 1: 255.29.

3. Values per holding

On the Portfolio sheet, SUMIFS rolls the transactions up per holding. Market value is units times price, and the weight is market value divided by the total:

Task In D2, work out the market value (units times price) and fill down to D6, with the total in D7. E2 is the weight of the holding in the portfolio: market value divided by the total. Fill E2 down to E6.

ABCDEF
1 Holding Units Price Market value Weight
2 World ETF 50 112
3 Emerging ETF 100 31.5
4 Sample Corp 30 85
5 Bitcoin 0.04 50000
6 Bond ETF 40 49.5
7 Total
8
9

This exercise is part of Premium.

Premium unlocks every exercise in every lesson, unlimited practice with fresh tasks and the final test with certificate.

See Premium Already Premium? Log in

The first exercise in this lesson is free.

4. Allocation and chart

For each asset class, =SUMIFS($H$6:$H$35,$C$6:$C$35,A40) adds up market value, which feeds a column chart. If you enter your own target split, the next column shows the difference in percentage points. What split suits you is your decision; the template does not recommend anything.

5. Checks

Conditional formatting marks in red: a sale of more units than you hold, a date earlier than the row above, and a holding that is missing on the Portfolio sheet. Losses show in red text.

Average cost and taxes

Average cost tells you what a unit cost you on average. Tax rules work differently and depend on where you live. In the US, if you cannot identify which shares you sold, the IRS treats the ones you acquired first as sold first; average basis is an option for mutual fund shares (IRS Publication 550). In the UK, shares of the same class are pooled at average cost in a "Section 104 holding", but shares bought on the same day as a sale or within the next 30 days are matched first (HMRC helpsheet HS284). Your realized gain here may therefore differ from your tax figures. This page is not investment or tax advice.

Common mistakes

Leaving out fees

Trading fees add to the cost of a buy and reduce the proceeds of a sale. Without them every gain looks bigger.

Rows out of date order

If a sale comes before the buy, the holding before it is too small. The sheet flags a date earlier than the row above.

A name spelled differently

"World ETF " with a trailing space is a different holding to SUMIFS. The drop-down list prevents that.

Stale prices

Market value is only as current as the price you enter, which is why the date of the prices sits at the top.

The formulas in German Excel

EnglishGerman
SUMIFS, SUMIF, SUMSUMMEWENNS, SUMMEWENN, SUMME
ROUND, MIN, IF, OR, NRUNDEN, MIN, WENN, ODER, N
COUNTIF, COUNTZÄHLENWENN, ANZAHL

German Excel uses semicolons: =RUNDEN(I13*D13/H13;2).

Which Excel versions does this work in?

Every function in the template works in all current versions of Excel, including Excel for Mac and Excel for the web. To unprotect a sheet, use Review > Unprotect Sheet; there is no password.

FAQ

Is the tracker free?

Yes. Create a free account to download the Excel file, with no subscription and no payment details.

Can Excel fetch prices for me?

Excel for Microsoft 365 has a Stocks data type (Data > Stocks). Microsoft notes that the prices are delayed and not for trading purposes or advice (Microsoft Support). The template uses typed-in prices on purpose so it works in every version.

How do I record regular monthly investing?

Each purchase as a buy with date, units (fractions are fine) and price. To see what a fixed monthly amount could grow to, try the savings tracker.

Can I include cash?

Yes: add it as a holding with a price of 1 and the amount as units, so it counts in the allocation.

What is the target split for?

It is a split you choose for yourself. The sheet only works out the difference and warns you if your targets do not add up to 100%.

Next: net worth tracker

Investments, bank accounts, retirement savings and loans in one sheet: your net worth month by month.

Open the net worth tracker

Write to us

Choose language

Select your preferred language