InvoiceKaro
Stock and inventory

Average cost and cost of goods sold, explained simply

Learn how weighted average cost works with a three-purchase example, how one sale is costed, and how cost of goods sold for a month is worked out.

15 November 2026 5 min readBy the InvoiceKaro team
In this article

You bought the same charger three times this month, at three different prices. Today you sold five of them. What did those five cost you? If you guess with the latest price, your profit is wrong. If you guess with the oldest price, it is wrong the other way. Weighted average cost gives you one fair answer, and it is easy to work out.

Two terms in plain words

  • Average cost is what one unit on your shelf has cost you, on average, across all the stock you still hold.
  • Cost of goods sold (often written COGS) is what the items you actually sold cost you. Not what you bought this month: what you sold.

The difference matters. If you buy ₹1,00,000 of stock in October and sell only half of it, your October cost is about ₹50,000. The other half is still on the shelf. It is not a cost yet. Treating every purchase as a cost makes a restocking month look like a loss and a quiet month look like a great one.

A worked example with three purchases

Say you sell a phone charger. All prices here are before GST. You start the month with none in stock.

DateWhat happenedUnits on handValue of stockAverage cost
1 OctBuy 20 at ₹150 (₹3,000)20₹3,000₹150.00
10 OctBuy 30 at ₹160 (₹4,800)50₹7,800₹156.00
18 OctSell 30, costed at ₹156 (₹4,680)20₹3,120₹156.00
25 OctBuy 60 at ₹170 (₹10,200)80₹13,320₹166.50
28 OctSell 5, costed at ₹166.50 (₹832.50)75₹12,487.50₹166.50

The rule is the same at every purchase: add the new purchase to the value of what you already hold, then divide by the new number of units. On 25 October that is ₹3,120 + ₹10,200 = ₹13,320, divided by 20 + 60 = 80 units, which gives ₹166.50.

A sale does not change the average. It takes units out at the current average, so the value and the count fall together. On 18 October, 30 units left at ₹156 each, and the 20 that remained were still worth ₹156 each.

Costing one sale

Look at the sale on 28 October. You sold 5 chargers at ₹249 each.

LineAmount
Sale value (5 × ₹249)₹1,245.00
Cost of goods sold (5 × ₹166.50)₹832.50
Gross profit₹412.50
Gross margin (₹412.50 ÷ ₹1,245)33.1%

Compare the guesses. Costed at the latest price of ₹170, the same sale shows a profit of ₹395. Costed at the oldest price of ₹150, it shows ₹495. Neither is the truth about the stock you hold. The average is the honest middle, and it does not jump about every time a supplier changes the price.

Save the cost at the moment of sale
The cost of a sale should be fixed on the day you make it. If next month you buy chargers at ₹180, the 28 October sale still cost ₹832.50. Recalculating old sales with new prices rewrites your past profit.

Cost of goods sold for a whole month

If you do not cost each sale, you can still work out the month's cost of goods sold from three figures:

Opening stock + Purchases − Closing stock = Cost of goods sold

Say you start the month with stock worth ₹40,000, buy ₹1,20,000 during the month, and count stock worth ₹50,000 at the end. Your cost of goods sold is ₹40,000 + ₹1,20,000 − ₹50,000 = ₹1,10,000. This method needs an accurate stock count at both ends of the month. Any theft, damage or counting mistake hides inside the figure, which is why costing each sale as it happens is better when you can manage it.

Mistakes that spoil the figure

  1. No opening cost. If you start with stock but enter no cost for it, the first sales look like pure profit.
  2. Purchases not entered. The average is only as good as the bills behind it. See why purchase bills matter.
  3. Counting stock purchases as expenses. Stock becomes a cost only when it sells.
  4. Mixing in GST. Keep cost and sale figures before GST, so the tax does not inflate both sides.

How InvoiceKaro handles this

InvoiceKaro uses weighted average cost. Each purchase bill for a catalogue item updates that item's average, and the opening stock cost you enter becomes the starting average. When an invoice is issued or a quick bill is saved, the current average cost is saved against that sale, and later purchases do not change it. The profit report then shows revenue, cost of goods sold and gross profit for the period, and Margin by item shows the margin on each item. Cost prices, average cost and profit figures are visible to the owner only. See Expenses & profit.

Common questions

What is weighted average cost?+
It is the total value of the stock you hold divided by the number of units. Each new purchase is added to the value and the units, and the average is worked out again.
How do I calculate cost of goods sold for a month?+
Add your opening stock value and the month's purchases, then subtract the value of closing stock. Opening ₹40,000 plus purchases ₹1,20,000 minus closing ₹50,000 gives ₹1,10,000.
Does a sale change the average cost?+
No. A sale removes units at the current average, so the count and the value fall together and the average stays the same. Only a purchase at a different price changes it.
Should I include GST in the cost price?+
Work with figures before GST for cost and for sales, so the margin reflects your trade. Ask your accountant how to treat any GST you cannot recover.

Keep reading