If a piece of machinery costs £26,000 and you sell it several years later for £9,000 the net cost to you has been £17,000. You cannot have more than £17,000 in capital allowances. The excess allowances may be absorbed by a claim for AIA or writing down allowances in the later year but those excess allowances caused by the disposal of an item on which AIA has been claimed will be clawed back. If the disposal proceeds exceed the value of the pool, there will be a balancing charge which will be added to the trading profit or deducted from the trading loss.
If you claim the costs of the van and the machinery under the Annual Investment Allowance Scheme, all the costs are written off against one accounting period's income and your profit would be reduced by £26,000. That sounds great until you sell anything you have claimed AIA for as the disposal proceeds will come into your Capital allowances calculation for the year you dispose of the items, reducing any allowances for that year.
Any capital item you buy which has private use goes into a pool on its own and the allowances are reduced by the private use percentage. Depreciation has no effect on the capital allowances pool. Depreciation is simply an accounting convention and has no effect on the capital allowances. What you sell a piece of machinery for may not bear any relation to its depreciated value on the balance sheet in the accounts.
Take a look here
for more information on capital allowances and balancing charges. There are some good examples in HS252 (the first link).
I hope this helps but let me know if you have any further questions.