When an asset is sold, the depreciation expense is first recorded up to the date of the sale. Then the asset and its accumulated depreciation is removed and the proceeds are recorded.
Here's an example. A company has Equipment of $600,000 and Accumulated Depreciation of $380,000 before an item of equipment is sold. The original cost of the equipment being sold was $50,000. The first step is to record the current period's depreciation on that one item. Let's assume the depreciation will be $500. Let's also assume that after it is recorded, the item's accumulated depreciation will be $40,500. The company receives $5,000 for the equipment. The journal entry to record the disposal will consist of a debit to Cash for $5,000; a debit to Accumulated Depreciation for $40,500; a debit to Loss of Disposal of Asset for $4,500; a credit to Equipment for $50,000.
Prior to this transaction, the balance in the Accumulated Depreciation account was a credit balance of $380,000. The asset's current period depreciation of $500 increased the account's credit balance to $380,500. The disposal of the asset will reduce the balance in Accumulated Depreciation by $40,500 to a new balance of $340,000.