what is FIFO/realized P&L tracking ?

FIFO & Realized P&L — Simple Guide for Investors

FIFO (First-In, First-Out) and Realized P&L are how many brokers and spreadsheets decide which shares you sold and how much profit/loss you actually locked in.

What these terms mean

  • FIFO: When you sell, the system assumes you sell your oldest shares first.
  • Realized P&L: Profit/Loss from trades you have closed (you sold). Gains/losses on unsold positions are unrealized.
Quick formula For each matched lot under FIFO: Realized P&L = (Sell Price − Cost per Share) × Quantity Sold

Worked example (FIFO matching)

DateActionQtyPriceValue
Jan 10Buy100$10.00$1,000
Feb 01Buy50$12.00$600
Mar 05Sell120$15.00$1,800

Under FIFO, the 120 sold shares come from the oldest lots first:

Lot used (FIFO)Qty matchedCost/shareSell priceP&L/shareRealized P&L
Buy @ $10.00 (Jan 10)100$10.00$15.00$5.00$500.00
Buy @ $12.00 (Feb 01)20$12.00$15.00$3.00$60.00
Total realized P&L$560.00
Sale summary
  • Sold: 120 shares @ $15.00
  • Realized P&L: $560.00
  • Realized P&L/share (avg): $560 ÷ 120 = $4.67
What remains (after sale)
  • Leftover from $12.00 lot: 30 shares
  • Unrealized P&L depends on current market price

Why it matters

  • Taxes: FIFO determines the cost basis used to report gains/losses.
  • Clarity: Separates what you’ve actually earned (realized) from paper gains (unrealized).
  • Consistency: Using one method across all trades keeps records clean.
Other cost-basis methods (very short)

LIFO sells your newest shares first; Average Cost uses a blended cost per share. Your broker or local rules may restrict which methods you can use. Always check your local tax guidance.

How to track this in a spreadsheet

  1. Keep a “Transactions” sheet with columns like: Date, Ticker, Action (Buy/Sell), Qty, Price, Fees, Lot ID (auto for buys).
  2. FIFO queue logic: When you sell, allocate the sold quantity to the oldest open buy lots:
    • Reduce each lot’s remaining quantity until the sale is fully matched.
    • For each matched portion, compute (Sell Price − Lot Cost) × Matched Qty.
  3. Roll-up Realized P&L by sale (sum of its matched portions) and by ticker (sum of all sales).
  4. Holdings view: Sum remaining quantities per open lot (that weren’t fully sold) to show your current inventory and unrealized P&L.
Tip If you already use a “Transactions → Holdings” workflow, you can add a Lot Allocation helper table to record how each sell maps to one or more earlier buy lots. This keeps FIFO auditable and clean.

Disclaimer: This is general information for record-keeping. Tax rules vary by country; consult local regulations or a professional.

Previous Post Next Post
📑