Adjusted Cost Base        for Canadians
 See also: ACB Calculator
You bought 100 units of some fund or stock, in 1996.
In 1997, you bought another 100 units.
In 1998, you sold 100 units and, assuming the investment has increased in value, you pay capital gains.
Aaah, but on which 100 units? The 1996 units? The 1997 units?

In fact, for purposes of computing your capital gains, it's assumed that the 100 units you're selling were bought at some kind of average purchase price, or, to put it differently, at the Adjusted Cost Base (ACB).

What's the ACB? It's the ratio: Cost of Purchases/Total Units Held.
Total Units Held ... that's easy to determine, but what's the Cost of Purchases?

The initial Cost of Purchases is just the initial out-of-pocket monies it cost to make your first investment, including any commissions. Let's call this C(1)
The initial Total Units Held we'll call U(1) ... that's what you bought with your \$C(1)
Initially, then, ACB(1) = C(1)/U(1) the Magic Ratio

Suppose you later buy more units, say u(2) units.
Then the Total Units Held, after this 2nd transaction, is:
U(2) = U(1) + u(2)     adding the newly purchased units to the Total Units
and the Cost of Purchases is:
C(2) = C(1) + c(2)    adding the cost of the newly purchased units to the Total Cost
and, as usual, the ratio gives:
ACB(2) = C(2)/U(2).

Note 1: Reinvesting dividends/distributions counts as new purchases!

After n such purchases we have:
C(n) = Σc(i) adding all the purchase costs (including commissions)
U(n) = Σu(i) adding all the units purchased
and, finally, the Magic Ratio:
ACB(n) = C(n)/U(n)

Now comes the interesting part; you sell some units.
Because the ACB is the Adjusted COST Base, it involves the COST of purchasing units and doesn't change when you sell units!
That means that the Magic Ratio must not change after a sale of units:
If the Cost of Purchases and Total Units Held change (by virtue of selling u units)
from C & U    to    C' & U', then
the Magic Ratio = ACB = C'/U' = C/U ... cuz it don't hardly change after a sale

We know what the Total Units Held becomes after this sale of u units,
it's U' = U - u subtracting the u units that were sold

And the Cost of Purchases? What becomes of it?
Since C'/U' = C/U we get
C' = U' C/U and, since U' = U - u
C' = (U - u) C/U = C - u {C/U}
but {C/U} is the Magic Ratio or ACB, so we have, after a sale of u units:
Cost of Purchases = C - u {ACB}

Conclusion? The Cost of Purchases is decreased, after a sale of u units, as though these units were purchased at a cost equal to the current Adjusted Cost Base. See? I told you!

In fact, if you sell 10% of your units then the number of units gets reduced by 10% and so does the Cost of Purchases ... so their ratio remains unchanged! To see this, we write:

U' = U - u = U(1-u/U)

which says the Total Units Held has been reduced by a factor (1-u/U) (because of the sale of u units). In order that the ACB remain unchanged the Cost of Purchases must be reduced by the same factor. That gives:
C'/U' = C (1-u/U)/U (1-u/U) = C/U

The moral?
 If your Total Units Held, U, is reduced by x%, then your Cost of Purchases , C, must also be reduced by x%.

Note 2:
Note that, when selling units, your Cost of Purchases is NOT reduced by the money obtained by the sale. It's reduced by a percentage ... the same percentage as your units were reduced. Had you calculated "Cost" by simply adding \$\$ investments when you buy and subtracting \$\$ withdrawals when you sell, you'd get something different. (See Note 3, below.)

Because both C and U get reduced by some positive factor when selling, neither can become negative, so ACB = C/U is always a positive number (unless you sell more units than you own).

We now have the following scheme to change from "old" to "new" variables, after a transaction involving u units:

C = Cost of Purchases
U = Total Units Held
ACB = Adjusted Cost Base = C/U
Note: Purchase of units should include re-invested dividends.
 After a purchase of u units, costing \$c (including commissions): C(new) = C(old) + c     You've spent c more dollars U(new) = U(old) + u     You have u additional units ACB(new) = C(new)/U(new) After a sale of u units C(new) = C(old) - u ACB(old)     Units sold at the Adjusted Cost Base U(new) = U(old) - u     You have u fewer units ACB(new) = C(new)/U(new) = ACB(old) Capital Gain = Proceeds of Sale - u ACB(old) where Proceeds of Sale is after redemption fees, etc. have been deducted.

Example:
We've spent \$5,000 and hold 416.67 units and our ACB is currently \$12.000 and now:
We buy 400 units at \$12.50/unit (that's 400*12.5=\$5000)
NEW (cumulative) cost of purchases is \$5,000 + \$5000 = \$10,000
NEW "units held" is 416.67 + 400 = 816.67 (we hold 400 more units)
NEW ACB is 10000/816.67 = \$12.245 (it's always: Cost/Units)

Example:
We've spent \$10,165.28 and hold 830.77 units and our ACB is currently \$12.236 and now:
We sell 300 units at \$15/unit (that's 300*15=\$4500)
and there's a 3% transaction cost so we're left with .97*4500 = \$4365.00
NEW (cumulative) cost of purchases is 10,165.28 - 300*12.236 = \$6494.49 (subtract 300 units at the old ACB)
NEW "units held" is 830.77 - 300 = 530.77 (we hold 300 fewer units)
NEW ACB is 6494.49/530.77 = 12.236 (unchanged!)
CAPITAL GAIN is 4365.00 - 300*12.236 = 694.21 (as though we had bought these 300 shares at the ACB of 12.236)

Note 3:
If you hold U units in your portfolio, and your out-of-pocket cost to achieve this portfolio is \$A (made up of the Sum of Investments minus the Sum of Withdrawals), then A/U is your Cost per Unit. The ACB is not to be confused with your Cost per Unit. ACB cannot be negative whereas your Cost per Unit can be negative.

The Cost per Unit can also be regarded as your Break Even price (ignoring commissions). If you sold your current units at this Cost per Unit, you'd recoup all your money. If the Cost per Unit is negative, it means that the stock price could go to \$0 and you'd still be ahead!

Suppose your portfolio has 50 units which are currently worth, say, \$10 and your Adjusted Cost Base is \$5. You might think you're making money! That's not necessarily true. It may be that you bought 1000 units at \$5 (so your ACB is \$5). Then you sold 950 units at \$1 - losing a bundle of money - and now, the 50 remaining units in your portfolio are worth \$10 each. However, you're still in the red. Nevertheless, since the ACB didn't change when you sold units, it's still \$5!

On the other hand, had you sold the 950 units at \$100 (instead of \$1, thereby making a bundle of money) then you've already made more than your initial investment ... your Cost per Unit is now negative (tho' your ACB is still \$5).

As you might expect, there's a spreadsheet to do all this stuff.