Weighted average share price: purchases, partial sales, and FIFO explained

Calculate a quantity-weighted purchase price, verify it with a worked example, and understand why remaining holdings can differ after FIFO sales.

By HoldingsTracker Pro · Organization author

Product documentation and worked examples for the HoldingsTracker Pro browser extension. No investment recommendations.

Published · Updated

Weighted average price answers a narrow question: how much did each share cost on average across the quantities being counted? It is useful for checking multiple purchases. It is not a valuation model, a recommendation to average down, or proof that a future sale will be profitable.

The essential word is “weighted.” A purchase of five shares must not carry the same influence as a purchase of fifty shares. Weight by quantity, and state whether the calculation concerns all purchases or only the lots remaining after sales.

Use total purchase value divided by total quantity

For purchases of the same security in the same currency, with no sales or corporate actions:

Weighted average price = sum(quantity × purchase price) ÷ sum(quantity)

Keep calculations at full available precision and round the displayed answer last. If total quantity is zero, the average is undefined; displaying ₹0 suggests information that does not exist. Negative quantities require a different position model rather than being silently mixed into a delivery-purchase calculator.

Worked example: unequal lots

Suppose you make three purchases of fictional Amber Tools:

Lot Shares Price per share Purchase value
First 12 ₹400 ₹4,800
Second 18 ₹450 ₹8,100
Third 30 ₹380 ₹11,400
Total 60 ₹24,300

The quantity-weighted price is ₹24,300 ÷ 60 = ₹405. A simple average of the three quoted prices is approximately ₹410, which is wrong for these unequal quantities. The larger ₹380 purchase pulls the correct result downward.

An independent check is to multiply the answer back: 60 × ₹405 = ₹24,300. The answer also lies between the lowest and highest purchase prices, ₹380 and ₹450. A value outside that range signals a mistake for this positive-quantity, fee-exclusive example.

At a hypothetical market price of ₹420, the marked value would be 60 × ₹420 = ₹25,200. Gross unrealised gain would be ₹900, approximately 3.70% of the ₹24,300 cost. That percentage says nothing about holding period or investment quality.

Why a partial sale changes the question

Now suppose you sell 20 shares on a later day at ₹430. Using FIFO, the sale consumes all 12 shares from the first lot and eight from the second. The sold cost is ₹4,800 + ₹3,600 = ₹8,400. Sale proceeds are ₹8,600, producing ₹200 gross realised gain before charges.

The remaining lots are ten shares at ₹450 and thirty at ₹380. Their total cost is ₹4,500 + ₹11,400 = ₹15,900 across 40 shares. The remaining average is therefore ₹397.50, not ₹405.

Zerodha documents FIFO treatment in its buy-average calculation. A calculator that only combines purchase rows cannot reproduce that remaining average unless you first identify the correct unsold lots. Do not insert a sale as a negative purchase and assume that implements FIFO.

Fees and corporate actions need explicit treatment

If a separate cost-inclusive calculation adds ₹60 of purchase charges to the original ₹24,300, its average is ₹24,360 ÷ 60 = ₹406. Label this as a cost-inclusive average; do not assume a broker display uses the same convention. For partial sales, allocate costs consistently and avoid deducting them twice. The after-charges guide explains the reconciliation.

A share split changes quantity and per-share basis without itself creating profit. Transfers, bonuses, mergers, and missing acquisition records may need transaction-specific adjustments. Collect those records instead of forcing every event into the purchase-only formula. Same-day trading can also have different broker treatment from the simplified later-day sale above.

Use an average as a check, not a decision rule

A lower average after another purchase does not make the business safer. It increases the amount committed, and may raise concentration even if the displayed loss percentage falls. Calculate the new total exposure alongside the new average.

Check your purchase rows and charges against the worked examples above, keeping a separate record of any sales. HoldingsTracker Pro's features support current research and insights; the extension does not reconstruct a historical lot ledger. Use broker records for reconciliation and help for product questions. Continue with realised versus unrealised results when a sale is involved. HoldingsTracker Pro is independent of Zerodha. These hypothetical calculations are educational, not investment recommendations or tax advice.

Primary sources

Sources support the broker-specific context. Worked examples use fictional inputs and independent arithmetic, not investment recommendations.