You will just have to put your trading details i.e. Transaction Type (buy or sale), Date & Time of Transaction, Bitcoin Quantity in columns A to D and sheet will automatically calculate FIFO gains and other important data for every row. You will see Gain or Loss after every transaction on FIFO basis in column U. Besides this, spreadsheet will also show you other important data e.g. Cumulative Cost of Bitcoin Purchased, Cumulative Earning from Sell of Bitcoin, Total Bitcoin Purchased, Total Bitcoin Sold, Bitcoin in Hand after every transaction.

Columns P, Q, R and S contain formulas for calculating costs of coins sold in parts. These formulas are complex and doing the calculation on FIFO method. These contain intermediate results. You may show or hide them as per your choice.

You can set exchange commission for buy or sell transaction in 2 ways:
First method is to set a fixed percentage for all Buy and Sell transactions in cells B1 and B2. It will be used to fill amount of commission (in $) for each transaction in column F and remove values from column E.

In second method you can manually fill amount of variable commission (in $) for each transaction in column E. In that case, value in column F will NOT be used by sheet.
Formula to calculate Effective Price after Commission in column G will first look for commission amount in column E. If it is blank, then commission amount from column F will be used (which itself is derived from %age values from cells B1 and B2).

You can adopt both the methods together, but remember that value in column E always takes precedence over column F.

Google Sheet is ready to calculate FIFO gains up to 2000 transactions, which can easily be extended further by dragging the formulas as per your requirement.

Sheet automatically highlights the rows for Buy and Sell transactions in Green and Orange colors so user can easily identify a Buy or sell transaction.

The tool is ready to calculate gains for 5 coins (Bitcoin, Bitcoin Cash, Ethereum, Litecoin and Ripple) and summary of these gains is shown in "Summary" sheet. User can copy or rename these sheets for other cryptocurrencies as well.

Google Sheet Version of Bitcoin Cryptocurrency FIFO Gain Calculator