AwardXero App of the Year Awards 2026 Finalist
qoblex_logo_main

Inventory

Moving Average Cost: Formula and Worked Example

Moving average cost (MAC) is an inventory costing method that recalculates a product's average unit cost every time new stock is received. The new average is the total value of the stock on hand divided by the units on hand. Each sale is then costed at the average in force on the day it ships, so a sale never changes the average; only a receipt does.

This article covers the formula, a worked example with sales between purchases, how MAC compares with FIFO and weighted average cost on the same numbers, why landed costs belong in it, and how Qoblex calculates it for you.


Moving average cost formula

Recalculate the average each time stock comes in:

New MAC = (units on hand × current MAC + units received × landed unit cost) ÷ (units on hand + units received)

Cost each sale at the average in force when it ships:

Cost of goods sold = units sold × current MAC

Step by step:

  1. Take the value of the stock you already hold: units on hand × the current MAC.
  2. Add the value of the new receipt: units received × what each unit cost you, including freight and duty (the landed unit cost).
  3. Divide the total value by the total units. That is the new MAC.
  4. Value every sale, and the stock left behind, at that MAC until the next receipt.

To check your own numbers, use the moving average cost calculator.

Moving average inventory method example

A shop sells one ceramic mug. It starts June with 24 mugs at $4.50 each, then receives two purchase orders and ships two sales in between.

DateMovementUnitsUnit costCost of goods soldUnits on handStock valueMAC after
1 JunOpening stock24$4.5024$108.00$4.50
4 JunReceive PO+240$6.20264$1,596.00$6.0455
8 JunSale−120$6.0455$725.45144$870.55$6.0455
17 JunReceive PO+96$9.40240$1,772.95$7.3873
23 JunSale−180$7.3873$1,329.7160$443.24$7.3873

The two receipts work out like this:

  • 4 Jun: ($108.00 + 240 × $6.20) ÷ 264 = $1,596.00 ÷ 264 = $6.0455.
  • 17 Jun: ($870.55 + 96 × $9.40) ÷ 240 = $1,772.95 ÷ 240 = $7.3873.

Three things to notice:

  • The average moved twice, both times on a receipt. The sales on 8 and 23 June took stock out at the going average and left it unchanged.
  • June's cost of goods sold is $2,055.16, and the 60 mugs left are worth $443.24. Together they equal the opening stock plus June's purchases: $108.00 + $1,488.00 + $902.40 = $2,498.40.
  • The average is shown to four decimals and money to the cent. Keep the average itself unrounded, or rounding errors build up over hundreds of receipts.

Moving average vs FIFO vs weighted average cost

The same June movements, costed four ways:

MethodHow the sale is costedJune cost of goods soldValue of the 60 mugs left
FIFO (first in, first out)Oldest units first$1,934.40$564.00
Moving average costAverage at the time of each sale$2,055.16$443.24
Periodic weighted average costOne average for the whole month: $2,498.40 ÷ 360 units = $6.94$2,082.00$416.40
LIFO (last in, first out)Newest units first$2,167.20$331.20
  • FIFO keeps each purchase as its own layer. When prices rise, it gives the lowest cost of goods sold and the highest stock value. It suits stock that is sold in date order, such as food with expiry dates.
  • Moving average lands between FIFO and LIFO when prices rise, as they did here. It needs a system that updates stock on every movement (a perpetual inventory system), because the average changes with every receipt.
  • Periodic weighted average cost uses one average, worked out at the end of the month or year, for every sale in it. It suits businesses that count and value stock only at period end. See the weighted average cost guide.
  • LIFO is allowed in the US but not under IFRS. IAS 2 permits FIFO and weighted average cost formulas, and moving average is a weighted average updated on every receipt.

When to use moving average cost

Moving average cost fits when:

  • Units of a product are interchangeable, so it does not matter which carton a customer gets.
  • Purchase prices move around, and you want margins that follow them without jumping on every order.
  • Stock is updated on every receipt and sale, in software or a carefully kept ledger.

It fits less well when:

  • Each unit has its own cost, such as serial-numbered machines or one-off pieces.
  • Stock must be sold in date order and you want the cost to follow the same order. FIFO matches that.
  • You only count and value stock at month or year end. Periodic weighted average is simpler there.

Include landed costs, or the average is wrong

The unit cost in the formula is what each unit cost you to get onto your shelf, not the supplier's price. Freight, duty and handling belong in it. Leave them out and every unit is undervalued, so margins look better than they are until the freight bill hits the books somewhere else.

Example: the shop holds 30 jugs at $12.40 each ($372). It receives a purchase order for 120 jugs at $9.00 and 45 teapots at $36.00, with $270 freight. Split by value, the jugs ($1,080 of the $2,700 order) carry 40% of the freight, $108, so their landed cost is $9.90 each.

  • With freight: ($372 + 120 × $9.90) ÷ 150 = $10.40.
  • Without freight: ($372 + 120 × $9.00) ÷ 150 = $9.68.

Every jug sold from that stock would be costed $0.72 too low ($108 ÷ 150). On a spreadsheet this is the step most often skipped, because the freight invoice usually arrives separately from the goods.

How Qoblex calculates moving average cost

Qoblex keeps a running moving average cost for each product variant and updates it whenever stock comes in at a cost (purchase receipts, adjustments that add stock, production) or the cost is corrected, so you never recalculate it by hand.

  • Per-variant costing. Each variant's cost tracking policy is either Average Cost, which tracks moving average cost, or First In First Out. See Manage product variants. Qoblex only lets you change it while no location holds stock or a buffer for that variant, and it is worth agreeing the change with whoever owns your accounts.
  • Landed costs. Freight, duty and similar charges go on the purchase order as their own lines. You choose whether each charge is distributed into inventory cost or treated as an expense. Distributed charges are split across the order lines by value, as in the jug example, and become part of the moving average cost when the goods are received. See Add and distribute landed costs.
  • Bundles and manufacturing. A bundle's cost is the sum of its parts' moving average costs times their quantities (Bundles). A production order takes each component's unit cost from its moving average cost (Costs, wastage and yield).
  • Corrections. Editing a variant's moving average cost is recorded as a stock adjustment and needs adjustment access. On a stock count, a Set line records the product's moving average cost when you save the line (Create an adjustment).
  • A cost of zero. If a product's moving average cost is 0 when a sale ships, Qoblex sends no cost of goods sold for that sale, and correcting the cost later does not repost it. Set opening costs before you start selling. If it has already happened, see Fix sales with zero COGS.
  • Accounting. Qoblex posts inventory value to your Stock On Hand and Cost Of Goods Sold accounts. Keep the same products untracked in Xero, or non-inventory in QuickBooks, so the accounting software does not run its own average alongside: Xero, QuickBooks.

Frequently asked questions

What is moving average cost?

Moving average cost is an inventory costing method that recalculates a product's average unit cost after every receipt of stock. Sales are costed at the average in force when they ship, so the average changes on purchases, not on sales.

How do you calculate moving average cost?

Add the value of stock on hand (units × current average) to the value of the new receipt (units × landed unit cost), then divide by the total units. Example: 144 units worth $870.55 plus 96 units at $9.40 gives $1,772.95 ÷ 240 = $7.39.

What is the difference between moving average and weighted average cost?

Moving average is recalculated after every receipt, so each sale uses the average on its own date. Periodic weighted average uses one average for the whole month or year, taken over all the stock available in it, and applies it to every sale in that period.

Does a sale change the moving average cost?

No. A sale removes units at the current average, so the units and the value fall in proportion and the average stays the same. Under the method, only stock coming in at a cost, or a deliberate cost correction, changes it.

Is moving average better than FIFO?

Neither is better in general. FIFO follows the physical flow of dated stock and shows the lowest cost of goods sold when prices rise. Moving average smooths price swings and suits interchangeable stock. Both are accepted under IFRS and US GAAP.

Should landed costs be included in moving average cost?

Yes. Freight, duty and handling are part of what a unit cost you. Leaving them out understates every unit's cost and overstates margin. In the jug example above, ignoring $108 of freight puts the average at $9.68 instead of $10.40.


Share

Updated

Your next stage of growth is just a click away