Skip to content

How to Do Weighted Average Cost, With an Example

How to do weighted average cost: the formula, a month of coconut oil bought at three prices, periodic and moving average, against FIFO, and when to use it.

By Koa Sterling. Product specialist at TaroStack and small business owner. Yes, I am a real human, and I actually sit in front of a computer and write these articles. Reviewed October 12, 2026 · 6 min read

To do weighted average cost, add up the cost of everything you had available in a period (opening stock plus every delivery) and divide by the total units. That one average price is what each unit used and each unit left on the shelf is worth. In the example below, 240 liters of coconut oil bought at three prices average $6.65 a liter, so the 180 liters used cost $1,197 and the 60 left are worth $399. There's also a moving average, which recalculates after every delivery and is how inventory software usually does it. Below are both worked through, compared with FIFO, and when averaging is the better choice.

The short version

  • Weighted average = total cost available ÷ total units available.
  • Every unit used and every unit left takes that one price.
  • Moving average recalculates after each delivery, so the cost is current all month.
  • Averages smooth price swings; FIFO follows them.
  • Averaging suits stock that mixes in one bin or tank, like oil, flour or sugar.
  • Whichever you choose, use it every year.
  • TaroStack can cost your stock by moving average or FIFO, automatically. More below.

The formula

Weighted average cost per unit = (opening value + cost of all deliveries) ÷ (opening units + units delivered)
Cost of units used            = units used × weighted average cost
Value of units left           = units left × weighted average cost

A month of coconut oil

Windward Roots, the made-up taro business I use in these examples, fries its taro chips in coconut oil. October:

Date What happened Liters Price Value
Oct 1 On hand 40 $6.20 $248.00
Oct 2 Delivery 120 $6.50 $780.00
Oct 2 to 17 Used 100
Oct 18 Delivery 80 $7.10 $568.00
Oct 18 to 31 Used 80
Oct 31 On hand 60

Weighted average, for the month.

Available    40 + 120 + 80 = 240 liters, $248 + $780 + $568 = $1,596
Average      $1,596 ÷ 240 = $6.65 a liter
Used         180 × $6.65 = $1,197.00
Left         60 × $6.65 = $399.00

Moving average, after each delivery.

After Oct 2     160 liters for $1,028.00  →  $6.425 a liter
Used 100        100 × $6.425 = $642.50, leaving 60 liters at $385.50
After Oct 18    140 liters for $953.50    →  $6.811 a liter
Used 80         80 × $6.811 = $544.86, leaving 60 liters at $408.64
Total used      $642.50 + $544.86 = $1,187.36

The moving average knows the price at the moment each liter was used, so the oil used early in the month is cheaper than the oil used after the dearer delivery. The periodic weighted average only knows the month's total, and it can't be worked out until the month is over.

Against FIFO

Method Oil used Oil left
FIFO $1,170.00 $426.00
Moving average $1,187.36 $408.64
Weighted average, for the month $1,197.00 $399.00

FIFO uses the oldest liters first: all 40 at $6.20, all 120 at $6.50, and 20 at $7.10, leaving 60 at the newest price. Every row adds up to the same $1,596; the method decides only how it's split between this month's cost and the shelf. When prices are rising, FIFO gives the lowest cost and the highest shelf value, and averages land between. The wider comparison, with LIFO and write-downs, is in what is inventory valuation.

When averaging is the better choice

Average fits FIFO fits
Oil, flour, sugar or grain that mixes in one bin or tank Goods that stay separate, like cases with lot codes
Prices that bounce up and down Prices that move one way and you want the shelf near today's price
You want a steady cost per product You want cost to follow each delivery

The first row is the practical one. When a new delivery of oil is poured into the same tank as the old, nobody can say which liter is which, so an average describes what really happened. For cases and jars with their own lot codes, FIFO does. Both are commonly used and accepted for US taxes. Either way, pick one and keep it: changing later usually needs your accountant and IRS approval. This is general information, not tax advice.

What it does to a product's cost

Each bag of chips uses about 30 mL of oil. At $6.20 a liter that's 18.6 cents; at the moving average after October 18, $6.811, it's 20.4 cents. Small per bag, but on 2,900 bags a month it's about $53, and it's exactly the kind of drift a cost sheet built once never sees. How recipe costs are built from ingredient costs is in steps in recipe costing, and one batch's actual cost against its recipe is in batch costing example.

Where this stops working

Weighted average by hand means recalculating every time a delivery arrives, for every item, and carrying the new average into every recipe. With forty ingredients and a delivery most days, the spreadsheet falls back to "last price paid", which is neither average nor FIFO, and every product's cost is a little wrong in a way nobody can trace.

How TaroStack does it

TaroStack does the averaging, or the FIFO layers, for every item on every delivery, and carries it into every product.

Your method, kept for you. Stock is costed by moving average or in FIFO layers, chosen when you set up the business and locked once stock has moved, which is the consistency your accountant wants. Every delivery comes in at the price you paid, with freight and other landed costs spread across what arrived, so the average includes what it cost to get the oil to your door.

Into every batch and product. Each batch takes its ingredients at their current cost, so the bag of chips fried after the dearer oil arrived costs what it really cost. Recipes contain sub-recipes, so a cost change flows through to every product that uses the ingredient, and margins are reported per product on actual cost. A price-creep report per supplier shows the oil price climbing.

And the value is a screen. Stock value is kept at what it cost, per site, item and type, with a month-by-month history, so the oil left on October 31 is a number without a calculation.

The job By hand In TaroStack
New average after a delivery Recalculated, sometimes Automatic, every delivery
Freight in the average Usually left out Spread across what arrived
Cost of a bag of chips The average from spring This batch's cost
Month-end value A calculation Stock value, by month

Stock value, moving average or FIFO, and landed costs are on every plan, from $49 a month; recipes and batches that carry ingredient costs into products are on Standard at $99. The first 30 days are free, with no credit card. If you'd like a hand setting up, ask, and we'll do it with you.

Questions people also ask

How do you calculate weighted average cost?

Add the opening value and the cost of all deliveries, divide by the opening units plus units delivered. In the example, $1,596 ÷ 240 liters = $6.65 a liter.

What is the difference between weighted average and moving average?

Weighted average uses one average for the whole period, worked out at the end. Moving average recalculates after every delivery, so each unit used takes the average at that moment.

Is weighted average better than FIFO?

Neither is better everywhere. Averages suit stock that mixes in one bin or tank and prices that bounce; FIFO suits separate lots and keeps the shelf near today's prices. Pick one with your accountant and keep it.

Is weighted average cost allowed for taxes?

In the US, average cost methods are commonly accepted, as is FIFO. Use one consistently, and ask your accountant before changing.

We use AI to help with the research for these articles. Every one is read, checked against its sources and edited by Koa before it's published. Spot a mistake? Tell us and we'll fix it and say so. How we write these.

Let’s get your stack in order.

Get TaroStack

Sign up now for your free 30 day trial. No credit card required.