Sub topic 7
Weighted average: one blended unit cost
This chapter assumes you know the goods available for sale equation (beginning inventory plus purchases equals COGS plus ending inventory). It also assumes you know the difference between periodic and perpetual systems. The example is the one used throughout this tutorial: 100 units at $10, 200 at $12, and 100 at $14, with 250 units sold.
The idea
Weighted average cost does not track which purchase layer a unit came from. It blends all available costs into one unit cost and uses that cost for both COGS and ending inventory.
The unit cost is total cost divided by total units, not a simple average of the unit prices:
weighted average unit cost = cost of goods available for sale ÷ units available for sale
Periodic weighted average
In a periodic system you compute one average at the end of the period.
- Goods available: 100 + 200 + 100 = 400 units, costing $1,000 + $2,400 + $1,400 = $4,800.
- Average cost: $4,800 ÷ 400 = $12.00 per unit.
- COGS: 250 × $12 = $3,000.
- Ending inventory: 150 × $12 = $1,800.
The two parts add back to $4,800. FIFO gave COGS of $2,800 and LIFO gave $3,200, so the average falls between them.
Perpetual weighted average (moving average)
In a perpetual system the average is recalculated after every purchase. Each sale is costed at the average in force on the sale date. This is called the moving average method.
The example's purchases and sales fall on these dates:
- Day 5: buy 200 at $12.
- Day 10: sell 150.
- Day 15: buy 100 at $14.
- Day 20: sell 100.
# Perpetual moving average: recompute the average cost after every purchase.
# Start: 100 units at $10 = $1,000 on hand.
units, total_cost = 100, 1000.0
cogs = 0.0
events = [
('buy', 200, 12), # day 5
('sell', 150, None), # day 10
('buy', 100, 14), # day 15
('sell', 100, None), # day 20
]
for kind, qty, unit_cost in events:
if kind == 'buy':
units += qty
total_cost += qty * unit_cost
else:
avg = total_cost / units
out = qty * avg
cogs += out
units -= qty
total_cost -= out
print('sale of', qty, 'at average', round(avg, 4), 'cost', round(out, 2))
print(round(cogs, 2), units, round(total_cost, 2))
# sale of 150 at average 11.3333 cost 1700.0
# sale of 100 at average 12.4 cost 1240.0
# 2940.0 150 1860.0The first sale uses $3,400 ÷ 300 = $11.3333. After it, $1,700 remains for 150 units. The day 15 purchase brings the pool to $3,100 for 250 units, so the second sale uses $12.40.
Comparing the two systems
| System | Average used | COGS | Ending inventory |
|---|---|---|---|
| Periodic | $12.00, once per period | $3,000 | $1,800 |
| Perpetual | $11.33, then $12.40 | $2,940 | $1,860 |
The results differ because the perpetual system sells the first 150 units before the $14 purchase enters the pool. That purchase therefore never affects the day 10 sale.
Common errors
- Averaging the unit prices instead of weighting them. With 300 units at $10 and 100 at $14, the weighted average is $11, but a simple average gives $12. In this chapter's example both equal $12 only by coincidence.
- Using the periodic average in a perpetual system, or the reverse. Check which system the problem states.
- Forgetting to remove the cost of units sold from the pool before the next purchase.
- Rounding the unit cost too early. Carry full precision and round the final amounts.
Exercise
A firm starts with 300 units at $10. It buys 100 units at $14, then sells 200 units, in a periodic system. Find the weighted average unit cost, COGS, and ending inventory.
Show answer
Goods available cost $3,000 + $1,400 = $4,400 for 400 units. The average is $4,400 ÷ 400 = $11.00. COGS is 200 × $11 = $2,200. Ending inventory is 200 × $11 = $2,200. The total is $4,400, which matches goods available.
Exercise
Why does the perpetual moving average give COGS of $2,940 while the periodic average gives $3,000 for the same purchases and sales?
Show answer
The perpetual method costs each sale at the average on the sale date. The first 150 units are costed at $11.33 before the $14 purchase arrives. The periodic method waits until period end and applies one $12 average to all 250 units sold, so the later, higher-cost purchase affects every sale.