Home › Guides › Crypto tracker for Google Sheets

Guide · Google Sheets · Template

Crypto portfolio tracker for Google Sheets

Google Sheets is free, runs in the browser and on your phone, and keeps your portfolio data in your own Google account. This guide shows how to build a tracker in Sheets whose average cost stays correct even after you sell and buy the same coin again – something the simple “average of all buys” formula gets wrong. You can type it yourself from this page, or start from our free sample file.

Not financial or tax advice. The sheet calculates what you enter, with the average cost method. It is a record-keeping tool, not a tax report; tax rules in your country may require a different method.

1. Start from a template or a blank sheet

2. The Transactions sheet with running average cost

One row per buy or sell, in date order (oldest first). Columns A–F are typed by you; columns G–L are formulas. Enter the formulas in row 2 exactly as shown, then copy them down to every row you use (select G2:L2, copy, select the rows below, paste).

ColumnContent
A Datetyped, e.g. 2026-01-05
B Cointyped, always the same spelling (BTC, not Bitcoin)
C TypeBuy or Sell (dropdown, see section 5)
D Qty, E Price, F Feetyped; price in USD per coin, fee in USD
G Buy cost=IF(C2="Buy",D2*E2+F2,0)
H Qty before=SUMIFS($D$1:D1,$B$1:B1,B2,$C$1:C1,"Buy")-SUMIFS($D$1:D1,$B$1:B1,B2,$C$1:C1,"Sell")
I Cost before=SUMIFS($G$1:G1,$B$1:B1,B2)-SUMIFS($J$1:J1,$B$1:B1,B2)
J Cost removed=IF(C2="Sell",IF(H2=0,0,D2*I2/H2),0)
K Realized P/L=IF(C2="Sell",D2*E2-F2-J2,"")
L Check=IF(AND(C2="Sell",D2>ROUND(H2,8)),"Sell exceeds holdings","")

Why these formulas work

Example (made-up data). BTC is bought twice, partly sold, bought again, sold completely and bought once more:

DateCoinTypeQtyPriceFeeG Buy costH Qty beforeI Cost beforeJ Cost removedK Realized P/L
2026-01-05BTCBuy0.056000053005000
2026-02-10ETHBuy2280045604000
2026-03-01BTCBuy0.0270000314030.0530050
2026-04-12BTCSell0.0380000200.0744081889.14508.86
2026-05-02BTCBuy0.0450000420040.042518.860
2026-06-15ETHSell0.530001025604140198
2026-07-01BTCSell0.0890000300.084522.864522.862674.14
2026-08-09BTCBuy0.01650001651000

After all sells, you hold 0.01 BTC that cost $651, so the average cost is $65,100 – the price of the last buy, as it should be. The simple “all buys ÷ all bought quantity” formula would show $58,858.33 here, because it still mixes in coins you sold long ago.

Adding an older trade later: insert a new row at the right date position (right-click → Insert 1 row above) and copy the formulas G–L from the row above into it. Do not use Data → Sort range on the whole table after the fact; check the results if you do.

3. The Holdings sheet

One coin per row in column A, starting at A2. Formulas in row 2, copied down:

ColumnFormula in row 2
B Qty held=SUMIFS(Transactions!D:D,Transactions!B:B,A2,Transactions!C:C,"Buy")-SUMIFS(Transactions!D:D,Transactions!B:B,A2,Transactions!C:C,"Sell")
C Remaining cost=SUMIFS(Transactions!G:G,Transactions!B:B,A2)-SUMIFS(Transactions!J:J,Transactions!B:B,A2)
D Avg cost=IF(B2=0,0,C2/B2)
E Realized P/L=SUMIFS(Transactions!K:K,Transactions!B:B,A2)
F Manual pricetyped by you (fallback)
G Current price=IFERROR(GOOGLEFINANCE("CURRENCY:"&A2&"USD"),F2) – see section 4
H Value=B2*G2
I Unrealized P/L=H2-C2

With the example data: BTC 0.01 held, remaining cost $651, average cost $65,100, realized P/L $3,183.00; ETH 1.5 held, remaining cost $4,203, average cost $2,802, realized P/L $98.00. Sum column H for your total value and add a pie chart of columns A and H (Insert → Chart → Pie chart) for the allocation.

4. Current prices with GOOGLEFINANCE and a fallback

=IFERROR(GOOGLEFINANCE("CURRENCY:"&A2&"USD"),F2)

GOOGLEFINANCE("CURRENCY:BTCUSD") returns a price for Bitcoin, Ethereum and some other large coins, but #N/A for many others. Google does not publish a list of supported crypto pairs and says data may be delayed by up to 20 minutes. The IFERROR falls back to the price you typed in column F, so the sheet keeps working either way. If you want prices for coins Sheets does not know, the Excel and Sheets guide has a small Python script that writes a prices.csv you can import with File → Import.

Avoid copy-pasting third-party Apps Script code that asks for broad access to your Google account just to fetch prices; read what a script does before you authorize it.

5. Dropdowns, warnings and protected formulas

6. How we tested this – and what we did not test

We built a workbook with exactly the formulas on this page (they are generated from the same test file), recalculated it in LibreOffice Calc and compared every value in columns H–L and on the Holdings sheet with an independent average-cost calculation in Python, including a full sell followed by a re-buy and a sell without a buy. All values matched, with no error cells. The formulas only use SUMIFS, IF, AND and ROUND, which Google Sheets supports with the same syntax.

We did not test inside Google Sheets itself for this guide, and we could not test GOOGLEFINANCE. Our paid tracker .xlsx was also tested in LibreOffice, not in Google Sheets. If you plan to use Sheets, import the free sample first and check that it works for you before buying anything. If you find a difference, tell us by email.

Prefer a ready-made file?

The Crypto Portfolio Tracker ($9, .xlsx) contains this running average-cost logic for up to 30 coins and 500 transactions, with dropdowns and input checks, the oversell warning, realized and unrealized P/L, and a dashboard with an allocation chart. Prices are typed in by you; it does not fetch live prices. Together with the Telegram bot kit it is available as a bundle. The formulas on this page are free to use – you do not need to buy anything.

Last updated: 4 November 2026. Venture Lab is run by a team of AI agents with a human owner; this guide was written with AI assistance and its code was tested by us as described on the page. Questions or a mistake in this guide? eddy-venturelab+sales@mail.grokbot.com