How to Calculate Cost of Goods Sold

A practical IAS 2 guide to calculating COGS, recording the journal entry, and reading gross profit without mixing inventory with operating expenses.

What Is Cost of Goods Sold?

Cost of goods sold is the cost of inventory that became an expense because the goods were sold. If you are learning how to calculate cost of goods sold, start with that simple movement: inventory sits on the [balance sheet](/glossary#balance-sheet) while it is unsold, then moves to the [income statement](/glossary#income-statement) when the sale happens.

That movement is why COGS matters more than many beginners expect. It does not measure every cost in the business. It measures the cost directly connected to the products sold during the period. Rent for the head office, marketing campaigns, finance costs, and admin salaries may be real expenses, but they are not COGS unless they are directly part of bringing inventory to saleable condition.

Under IAS 2, inventory cost includes purchase price, import duties and non-recoverable taxes, freight-in, handling, conversion costs, and other costs needed to bring inventory to its present location and condition. It excludes selling costs, most administrative overheads, abnormal waste, and storage costs that are not necessary to production.

For a Saudi trading company, this distinction is practical. A Jeddah wholesaler may buy coffee machines, pay freight from the supplier, pay customs duty, and store the machines until sale. The purchase price, freight-in, and customs duty normally belong in inventory. The salesperson commission belongs in selling expense. Getting that split right keeps gross profit meaningful.

How to Calculate Cost of Goods Sold: The Basic Formula

The standard formula is:

Beginning inventory + Purchases and direct costs - Ending inventory = Cost of goods sold

This formula works because it starts with all goods available for sale during the period, then removes what is still unsold. What remains must be the cost of the goods that left inventory.

Worked example — Dammam Tools Trading. The company starts May with SAR 120,000 of tools in inventory. It buys SAR 340,000 more, pays SAR 14,000 freight-in, and pays SAR 6,000 customs duty. A physical count and cost report show ending inventory of SAR 155,000.

COGS is SAR 120,000 + SAR 340,000 + SAR 20,000 - SAR 155,000 = SAR 325,000.

If sales revenue for May was SAR 520,000, gross profit is SAR 195,000. That gross profit then flows into the [income statement](/learn/income-statement-explained), before operating expenses are deducted. If you accidentally include delivery-to-customer costs in inventory, COGS becomes too high and gross profit looks worse than the trading activity really was.

What Costs Belong in COGS Under IAS 2?

COGS comes from inventory cost, so the best way to control COGS is to control what enters inventory. IAS 2 says inventory cost includes three broad buckets.

  • Costs of purchase: supplier price, import duties, non-recoverable taxes, freight-in, handling, and trade discounts deducted from cost.
  • Costs of conversion: direct labor and allocated production overheads for manufacturers.
  • Other necessary costs: costs needed to bring inventory to its current location and condition.

For retailers and distributors, purchase costs are usually the main bucket. For manufacturers, conversion costs become just as important. Factory wages, machine depreciation, factory utilities, and production supervision can all be included when they are part of converting materials into finished goods.

IAS 2 is also clear about exclusions. Abnormal waste is expensed immediately. Selling costs are not inventory. General administrative salaries are not inventory unless they contribute directly to bringing goods to their current condition. Storage is excluded unless storage is required before the next production stage.

VAT adds a Saudi-specific point. For a VAT-registered business, recoverable input VAT is not part of inventory cost. If Riyadh Home Supplies buys goods for SAR 100,000 plus SAR 15,000 VAT and can recover the VAT, inventory is SAR 100,000, not SAR 115,000. The VAT accounting itself is covered in the [Saudi VAT journal entry guide](/learn/vat-accounting-saudi-arabia).

How to Calculate Cost of Goods Sold Under FIFO and Weighted Average

The basic COGS formula tells you the total. Inventory costing tells you which cost is assigned to units sold when prices change. IAS 2 allows FIFO and weighted average for interchangeable goods. It does not allow LIFO.

Worked example — Riyadh Campus Supplies. The company sells identical calculators to university bookstores.

Under FIFO, the 220 sold units are costed from the oldest layers first: 100 units at SAR 40 and 120 units at SAR 44. COGS is SAR 4,000 + SAR 5,280 = SAR 9,280. Ending inventory is 30 units at SAR 44 plus 100 units at SAR 48 = SAR 6,120.

Under periodic weighted average, total cost available is SAR 15,400 and total units available are 350. Average cost is SAR 44.00 per unit. COGS is 220 × SAR 44 = SAR 9,680. Ending inventory is 130 × SAR 44 = SAR 5,720.

Same units, same sales, different gross profit. That is why COGS connects directly to the [inventory valuation methods IFRS](/learn/inventory-valuation-methods-ifrs) article. The method does not change cash, but it changes timing of expense and the carrying amount of inventory.

Recording COGS in the Journal Entry

A sale usually creates two accounting effects. First, the company records revenue and the customer receivable or cash. Second, it removes the cost of the sold inventory and records COGS. Beginners often record the revenue side and forget the inventory side.

Suppose Al Qassim Sports sells fitness equipment for SAR 80,000 on credit. The inventory sold had a cost of SAR 52,000. Ignore VAT for this example.

This [journal entry](/glossary#journal-entry) shows the matching logic. Revenue of SAR 80,000 and cost of SAR 52,000 are recognized in the same period, so gross profit is SAR 28,000. That is the [matching principle](/glossary#matching-principle) in action.

In a perpetual inventory system, the COGS entry is posted at the time of sale. In a periodic system, the company may wait until month-end, calculate COGS using the formula, and record one adjusting entry. Both can produce correct results, but the perpetual system gives better daily visibility and fewer surprises at month-end.

How COGS Affects Gross Profit and Ratios

COGS is the bridge between sales and gross profit:

Sales revenue - Cost of goods sold = Gross profit

Gross profit tells you whether the core product economics work before rent, marketing, admin, finance costs, and tax. A company can have strong sales and still be weak if COGS absorbs too much of every riyal.

These differences are not cosmetic. A lower gross margin may push management to raise prices, renegotiate suppliers, or cut product lines. If the margin drop is caused by a classification mistake, the business may make the wrong decision.

COGS also affects working capital analysis. When inventory is overstated, COGS is understated and profit is overstated. When ending inventory is understated, COGS is overstated and profit is understated. That is why the inventory count, the [trial balance](/learn/trial-balance-guide), and the month-end review need to agree before financial statements are released.

Common Mistakes When Calculating COGS

These mistakes show up constantly in student answers and junior-accountant files.

  • Using purchases as COGS. Purchases are not automatically COGS. If some goods remain unsold, their cost stays in inventory.
  • Ignoring beginning inventory. You may sell goods this month that were purchased last month. Beginning inventory is part of goods available for sale.
  • Forgetting freight-in and import duty. Costs needed to bring inventory to saleable condition normally belong in inventory.
  • Including freight-out and sales commissions. Delivery to the customer and commissions are selling expenses, not inventory cost.
  • Capitalizing recoverable VAT. For a VAT-registered Saudi business, recoverable input VAT is a tax receivable, not inventory.
  • Skipping NRV review. IAS 2 requires inventory to be measured at the lower of cost and net realizable value. If obsolete stock is not written down, inventory and profit are overstated.
  • Changing costing methods casually. FIFO and weighted average can produce different COGS. Switching methods without a valid accounting-policy basis makes comparisons unreliable.

A useful month-end check is to ask three questions: Did we count what remains? Did we cost it using the approved method? Did we separate product costs from selling and admin costs? If the answer to any of those is weak, the COGS number is not ready.

Practice COGS Until the Formula Becomes Automatic

Reading the formula once is not enough. COGS becomes easy when you calculate it from messy, realistic data: opening inventory, purchases, freight-in, returns, discounts, ending counts, VAT treatment, and cost-flow assumptions.

On Accountery, you can practice COGS through inventory and [double-entry bookkeeping](/glossary#double-entry-bookkeeping) exercises. A good exercise forces you to decide what belongs in inventory, compute ending inventory, record the COGS entry, and explain the effect on gross profit. That is much closer to real work than memorizing a formula in isolation.

For SOCPA, ACCA, and CMA candidates, this topic is also exam-friendly. It combines IAS 2, journal entries, gross profit, and statement presentation in one workflow. If you can solve COGS cleanly, you are also strengthening inventory valuation, income statement analysis, and month-end close skills.

The fastest way to improve is to repeat the same scenario under different assumptions. Try one case with FIFO, one with weighted average, one with recoverable VAT, and one with an NRV write-down. The formula stays simple, but your accounting judgment gets sharper each round.