Module 07 · Inventory Accounting and COGS in Practice

COGS Worked Example: From Purchase Invoice to Gross Profit

A full COGS calculation from purchase invoices to journal entries, ledger, income statement and gross profit, in both periodic and perpetual systems.

12 min readLesson 5 of 10 in this moduleUpdated 2026-11-09

This worked example shows a COGS calculation from start to finish. A shop begins March with $18,000 of stock, buys $46,000 more, pays $2,000 freight-in, gets $1,500 of goods credited back and $500 of discounts, and counts $21,000 at month-end. COGS is $18,000 + $46,000 − $1,500 − $500 + $2,000 − $21,000 = $43,000. On net sales of $70,000, gross profit is $27,000, a margin of 38.6%.

Key takeaways

  • A COGS calculation starts with source documents (purchase invoices, credit notes, sales invoices) and ends on the income statement. Every step uses the same few numbers.
  • Under a periodic system, COGS is the result of an opening balance, net purchases and a stock count. Under a perpetual system, it is the sum of costs posted sale by sale. Both reach $43,000 here.
  • Purchase returns, purchase discounts and freight-in must be treated separately from the invoice amount, otherwise COGS is off by exactly their value.
  • The inventory ledger should roll forward cleanly: opening + purchases − cost of sales = closing. If it does not, find the missing document before closing the month.
  • Gross profit and gross margin are only as good as the closing stock count behind them.

What are we calculating, and for whom?

The business is the fictional furniture and home-goods shop Lakeside Home Goods. The month is March. All figures in this example are fictional, and we assume no sales tax so that the arithmetic stays visible. The goal is to answer a single question: what did the goods that Lakeside sold in March cost, and how much did it earn on them?

We will do it twice. First under a periodic system, where a count at month-end determines COGS. Then under a perpetual system, where each sale posts its own cost. If the difference between those two is new to you, the lesson on inventory accounting journal entries sets it out; if you want the underlying definition of COGS, start with what cost of goods sold includes.

The starting facts:

FactAmount ($)
Inventory on 1 March (at cost)18,000
Purchases from suppliers (three invoices)46,000
Goods returned to a supplier1,500
Early-payment discount taken500
Freight-in on those purchases2,000
Gross sales to customers72,000
Goods returned by customers (at selling price)2,000
Inventory counted on 31 March (at cost)21,000

Step 1: Collect and check the source documents

Every number above should trace to a document. A COGS figure you cannot trace is one you cannot defend.

DocumentSupplier / customerAmount ($)
Purchase invoice 1Oakline Timber20,000
Purchase invoice 2Harbor Textiles16,000
Purchase invoice 3Brightwell Ceramics10,000
Total purchase invoices46,000
Supplier credit note (returned goods)Harbor Textiles1,500
Freight invoice for inbound shipmentsNorthway Freight2,000

Invoice 1 carries a 2.5% early-payment discount if paid within terms. Lakeside pays on time, so the discount is 2.5% × $20,000 = $500. Sales for the month total $72,000 across all customer invoices, and credit notes to customers total $2,000.

Before posting anything, check three things. The supplier credit note refers to goods that were actually sent back. The freight invoice relates to March deliveries only. Goods that arrived on 31 March are on the shelf and in the count, with their invoice recorded in March as well; otherwise you create a cut-off error.

Step 2: Journalise the purchases side (periodic system)

Under a periodic system, purchases are debited to a Purchases account, not to Inventory. Each entry balances.

Purchase invoices received on credit:

AccountDebit ($)Credit ($)
Purchases46,000
Accounts payable46,000
Total46,00046,000

Goods returned to Harbor Textiles (credit note):

AccountDebit ($)Credit ($)
Accounts payable1,500
Purchase returns1,500
Total1,5001,500

Freight-in invoice:

AccountDebit ($)Credit ($)
Freight-in2,000
Accounts payable2,000
Total2,0002,000

Invoice 1 paid within terms, taking the discount:

AccountDebit ($)Credit ($)
Accounts payable20,000
Cash19,500
Purchase discounts500
Total20,00020,000

Notice that the discount does not reduce the Purchases account directly. It is recorded in its own account so that the gross purchase amount stays visible. For the underlying debit and credit rules, see debit and credit rules.

Step 3: Journalise the sales side

Revenue is recorded at the selling price. In a periodic system, no cost is posted at the time of sale.

Sales for the month:

AccountDebit ($)Credit ($)
Accounts receivable72,000
Sales72,000
Total72,00072,000

Customer returns and credit notes:

AccountDebit ($)Credit ($)
Sales returns2,000
Accounts receivable2,000
Total2,0002,000

Net sales are $72,000 − $2,000 = $70,000.

Step 4: Summarise the relevant ledger accounts

Posting these entries to the general ledger gives the following balances before the month-end adjustment.

Ledger accountBalance ($)Side
Inventory (opening, unchanged during the month)18,000Debit
Purchases46,000Debit
Freight-in2,000Debit
Purchase returns1,500Credit
Purchase discounts500Credit
Sales72,000Credit
Sales returns2,000Debit

These are the same accounts that appear on the unadjusted trial balance. The lesson on calculating COGS from a trial balance shows that full trial balance and how to check it.

Step 5: Count the stock and calculate COGS

At 31 March Lakeside counts its shelves and warehouse, values the items at cost, and arrives at $21,000. The method for the count is in the step-by-step stock opname. Then:

COGS = Opening inventory + Net purchases + Freight-in − Closing inventory

Net purchases = purchases − purchase returns − purchase discounts.

LineCalculationAmount ($)
Opening inventory18,000
Purchases46,000
Less: purchase returns1,500
Less: purchase discounts500
Net purchases46,000 − 1,500 − 50044,000
Add: freight-in2,000
Net cost of purchases44,000 + 2,00046,000
Goods available for sale18,000 + 46,00064,000
Less: closing inventoryFrom count21,000
Cost of goods sold64,000 − 21,00043,000

Step 6: Post the month-end entries

The ledger still has no COGS and an inventory balance that is a month old. Two entries fix it.

Move opening inventory and purchase accounts into COGS:

AccountDebit ($)Credit ($)
Cost of goods sold64,000
Purchase returns1,500
Purchase discounts500
Inventory (opening)18,000
Purchases46,000
Freight-in2,000
Total66,00066,000

Record closing inventory:

AccountDebit ($)Credit ($)
Inventory (closing)21,000
Cost of goods sold21,000
Total21,00021,000

The COGS account now has a debit balance of $64,000 − $21,000 = $43,000. For more on this kind of entry, see adjusting journal entries.

Step 7: Prepare the income statement and read gross profit

Now the numbers flow to the statement.

Lakeside Home Goods, MarchAmount ($)
Sales72,000
Less: sales returns2,000
Net sales70,000
Cost of goods sold43,000
Gross profit27,000
Gross margin (27,000 ÷ 70,000)38.6%
Operating expenses (rent 5,000, wages 9,000, utilities 1,200, other 2,300)17,500
Operating profit9,500

Gross profit is net sales less COGS: $70,000 − $43,000 = $27,000. The gross margin is $27,000 ÷ $70,000 = 38.57%, which we round to 38.6%. Operating profit after $17,500 of operating expenses is $9,500. To see how these layers differ, read the four layers of profit and, for the statement as a whole, how an income statement is laid out.

The same month under a perpetual system

Now run the same facts through a perpetual system, where Inventory is updated every time stock moves. The only new fact needed is the cost of the goods sold and of the goods customers returned. Assume the sales invoices carried a cost of $44,200 in total and the returned goods, which went back on the shelf, carried a cost of $1,200. This extra assumption is fictional.

EventDebitCreditAmount ($)
Purchases (three invoices)InventoryAccounts payable46,000
Goods returned to supplierAccounts payableInventory1,500
Invoice 1 paid early (2.5% discount)Accounts payableCash 19,500, Inventory 50020,000
Freight-inInventoryAccounts payable2,000
SalesAccounts receivableSales72,000
Cost of the goods soldCost of goods soldInventory44,200
Customer returns (selling price)Sales returnsAccounts receivable2,000
Returned goods back in stock (at cost)InventoryCost of goods sold1,200

The Inventory account then rolls forward like this:

Inventory accountAmount ($)
Opening balance18,000
Add: purchases46,000
Less: supplier return1,500
Less: discount500
Add: freight-in2,000
Less: cost of goods sold44,200
Add: returned goods restocked1,200
Ledger balance at 31 March21,000

And COGS is $44,200 − $1,200 = $43,000. The ledger says $21,000 of stock; the count also says $21,000. The two systems agree because nothing was lost. If the count had come to $20,400, a periodic system would have reported COGS of $43,600, silently including the $600 shortage. A perpetual system would have kept COGS at $43,000 and recorded the $600 as a stock difference to be investigated. The loss lesson is taken further in inventory shrinkage and write-downs.

Step 8: Sanity-check the result

Gross margin by itself says little until you compare it. Three simple checks:

  1. Roll-forward. Opening 18,000 + net cost of purchases 46,000 − COGS 43,000 = 21,000, equal to the count.
  2. Margin trend. Compare 38.6% with last month and the same month last year. An unexplained swing of a few points deserves a look at cut-off, returns and the count.
  3. Turnover. Average inventory is (18,000 + 21,000) ÷ 2 = 19,500. COGS ÷ average inventory = 43,000 ÷ 19,500 = 2.21 times in the month, or about 14 days of stock (31 ÷ 2.21 = 14.1). It is a useful yardstick for whether $21,000 of stock is reasonable for $43,000 of monthly cost.

The retail lesson on calculating COGS for a store applies the same checks to a store with many small items, and the month-end checklist for inventory and COGS turns them into a routine.

Gross sales and net sales

If you used the $72,000 gross sales figure, you would report gross profit of $29,000 and a margin of 40.3% (29,000 ÷ 72,000), overstating both. The $2,000 of customer returns is not revenue you kept, and the returned goods are back in the closing count, so always start from net sales of $70,000.

What changes if the numbers change?

A worked example is most useful when you can vary it. Try these, and recompute with the formula from Step 5:

  • Closing count is $19,000 instead of $21,000. Goods available stays $64,000, so COGS is $45,000, gross profit $25,000 and margin 35.7%. A lower count means a higher cost of sales.
  • Freight-in was never booked. COGS would be $41,000 and gross profit $29,000. The missing $2,000 flatters profit and understates payables.
  • FIFO versus average cost. The count of $21,000 is a quantity valued at a cost method. Change the method and the valuation of the 21,000 changes, along with COGS. The effect is explained in FIFO vs average costing.

Cost-flow assumptions and tax treatment differ by country, so check the rules that apply to your business.

How the same month looks in Reyuko

Reyuko is perpetual. A goods receipt debits Inventory and credits GRNI until the supplier's invoice arrives, which then clears GRNI and creates the payable. A sales invoice posts revenue, receivable and tax, plus Dr COGS / Cr Inventory at the cost set for the product (Average, FIFO, LIFO or FEFO). Stock adjustments and stock-take shortages post Dr Inventory shrinkage expense / Cr Inventory, separately from COGS. The inventory roll-forward above is therefore what the ledger already contains.

Frequently asked questions

What is a simple example of a COGS calculation?

A shop starts with $18,000 of stock, buys $46,000 more, pays $2,000 freight-in, and receives $1,500 of purchase returns and $500 of discounts. It counts $21,000 at month-end. COGS is 18,000 + 46,000 − 1,500 − 500 + 2,000 − 21,000 = $43,000. With net sales of $70,000, gross profit is $27,000.

How do I find cost of goods sold step by step?

Add up purchases, subtract returns and discounts, and add freight-in to get the net cost of purchases. Add that to opening inventory to find goods available for sale. Then subtract the closing inventory you counted. The remainder is cost of goods sold. Finally, subtract COGS from net sales to get gross profit.

Does cost of goods sold include discounts and returns?

Yes, in the sense that they adjust the cost. Purchase returns and purchase discounts reduce the cost of what you bought, so they reduce COGS. Sales returns and discounts reduce your revenue instead, so they reduce net sales. Keeping the two sides apart is how you get a correct gross margin.

Is the COGS the same under periodic and perpetual systems?

It should be when nothing is lost. In the example, both reach $43,000. The difference appears when stock goes missing or is damaged. A periodic calculation includes the shortage in COGS because the count is lower, while a perpetual system keeps COGS at the recorded cost of sales and shows the shortage as a separate adjustment.

Why does my gross profit change when I change the stock count?

Because closing inventory is subtracted in the COGS formula. A higher count lowers COGS and raises gross profit by the same dollar amount, and a lower count does the opposite. That is why a careful count and correct valuation at cost matter so much to the reliability of your margin.

How do I calculate gross profit from COGS?

Subtract COGS from net sales. With net sales of $70,000 and COGS of $43,000, gross profit is $27,000. Divide by net sales to get gross margin: $27,000 ÷ $70,000 = 38.6%. Always use net sales after returns, not gross sales, or the margin will be overstated.

Put this into practice in Reyuko

Reyuko posts inventory, cost of goods sold and gross profit from the same ledger, so the numbers in this lesson are the numbers on your reports.

Download Reyuko freeSee what's included