Here’s the good news:
your math is correct, but your logic does not follow GAAP (or IRS rules) for stock sales.
Under U.S. GAAP and U.S. tax rules,
you cannot recalculate a new DCA after a sale the way you’re doing it. Instead, you must remove the
cost basis of the specific shares sold using an approved method (FIFO by default), and the remaining shares keep their original per‑share basis.
Let’s walk through this cleanly and show exactly where your spreadsheet logic diverges from GAAP.
1. What GAAP/IRS actually require
For stock sales, GAAP and IRS rules treat each purchase as a
tax lot with its own cost basis. When you sell shares, you must remove the cost basis of the shares sold using one of these methods:
Allowed methods
- FIFO (default) – oldest shares sold first.
- Specific identification – only if you tell the broker at the time of sale.
- Average cost – only for mutual funds and certain ETFs, not for individual stocks.
Not allowed

Recalculating a new average cost after a sale (your method)

Treating the remaining shares as if their basis changes because you sold some

Using “remaining value ÷ remaining shares” for stocks
This is why your DCA recalculation to $66.43 is
not GAAP‑compliant.
2. Let’s apply the correct GAAP logic to your example
Your starting position
- 36 shares
- Cost basis per share: $71.09
- Total basis:
[ 36 \times 71.09 = 2559.24 ]
You sell 5 shares at $100
Under FIFO (default), the cost basis of the shares sold is:
[ 5 \times 71.09 = 355.45 ]
Capital gain
[ 500.00 - 355.45 = 144.55 ]
✔
Your gain calculation is correct.
✔
This part does follow GAAP/IRS rules.
3. What happens to the remaining shares?
Here’s the key point:
The remaining 31 shares keep their original cost basis of $71.09 each.
You do
not recompute a new DCA.
Remaining basis
[ 31 \times 71.09 = 2203.79 ]
This is the correct GAAP/IRS value —
not $2059.24.
4. Why your recalculation is not GAAP‑compliant
You did:
[ \text{Remaining value} = 2559.24 - 500 = 2059.24 ]
Then:
[ 2059.24 / 31 = 66.43 ]
This assumes:
- The sale proceeds reduce the cost basis of the remaining shares
- The remaining shares’ basis should be recalculated
Both assumptions are
incorrect under GAAP and IRS rules.
Why?
Because
sale proceeds never affect cost basis.
Cost basis only changes due to:
- Purchases
- Corporate actions (splits, mergers, spin‑offs)
- Return of capital
- Wash sale adjustments
- Certain fund‑specific average‑cost rules (not applicable to stocks)
Selling shares does
not retroactively change the basis of the shares you keep.
5. Summary Table
| Concept | Your Method | GAAP/IRS Method |
|---|
| Cost basis of shares sold | Correct | Correct |
| Gain calculation | Correct | Correct |
| Remaining basis | Incorrect (you subtracted sale proceeds) | Correct (subtract cost basis of shares sold) |
| New DCA | Incorrect (recomputed) | No new DCA — remaining shares keep original basis |
| GAAP compliance |  | ✔ |
6. Final Answers to Your Questions
1. Is the new DCA $66.43?
No.
The correct DCA remains
$71.09.
2. Is your gain calculation of $144.55 correct?
✔
Yes.
That part is fully correct and GAAP‑compliant.
3. Does your spreadsheet logic follow GAAP?
Not for the recalculation of DCA.
You must track tax lots and remove the cost basis of the shares sold, not recalculate a new average.
If you want, I can help you build a GAAP‑compliant spreadsheet structure that handles:
- FIFO
- Specific identification
- Running cost basis
- Realized vs. unrealized gains
- Multiple lots and partial sales