Just put your trading details in columns A:D and it will show LIFO gains. You can also set exchange commission for buy/sale in percentage in cells B1 and B2. Spreadsheet can be easily extended to more rows further by dragging the formulas (rows) as per your requirement.

You will just need to fill 4 fields i.e. Transaction Type (buy/sale) , Date of Transaction, BTC Quantity and Price in columns A:D and click on the macro button LIFO. Macro and formulas in columns E:Q will process this data and you will see Gain/Loss after every transaction (for each Lot) on LIFO basis in column N and Total LIFO Gain in column O. Besides this, spreadsheet will also show you other important data e.g. Cumulative Cost of BTC Purchased, Cumulative Earning from Sale of BTC, Total BTC Purchased, BTC in Hand and Cost of Balance BTC after every transaction.

Sheet automatically highlights Sale and Buy transaction rows in Red and Green colors respectively just for more clear identification of the type of trade.

Google Sheet Bitcoin Cryptocurrency LIFO (Last In First Out) Gain Calculator