Running a business isn’t just about receiving money from customers. It's also about understanding how much you actually earn from each transaction. That’s why calculating the Cost of Goods Sold (COGS) is something you should never skip.
COGS represents the total costs directly related to producing the goods or services sold by a business during a specific period. These costs include raw materials, direct labor, and overhead used in the production process.
Knowing your COGS helps you to:
- Understand your profit margins
- Manage production costs more effectively
- Measure product profitability
The COGS Formula
To calculate your Cost of Goods Sold (COGS), you can use this basic formula:
COGS = (Beginning Inventory + Purchases − Ending Inventory)
Here's what each component means:
- Beginning Inventory - The value of goods or raw materials your business had at the start of the period
(Remaining units from the previous period × purchase price at that time)
- Purchases - Total amount of products bought during the period.
(Units purchased during the period × purchase price)
- Ending Inventory The value of goods or raw materials still in stock at the end of the period.
(Remaining units at the end of period × purchase price)
How to Calculate COGS
To calculate COGS, follow these steps:

Determine Beginning Inventory
This is how much stock you had at the start of the period. For example, if your stock was worth Rp50,000,000 at the beginning of the month, that’s your beginning inventory.

Add Purchases
Throughout the month, your business likely purchased more raw materials or products to sell. Say you spent Rp200,000,000 on purchases — this is added to the total.

Subtract Ending Inventory
At the end of the month, you’ll have unsold stock left. If that inventory is worth Rp30,000,000, subtract this from the total above.
Example of a COGS Calculation
Let’s say Abadi Company had 10 bicycles in stock at the beginning of February. During the month, they bought 20 more units. Each unit cost Rp5,000,000. They managed to sell 26 bikes that month for Rp18,000,000 each.
So the breakdown is:
- Beginning Inventory: 10 × Rp5,000,000 = Rp50,000,000
- Purchases: 20 × Rp5,000,000 = Rp100,000,000
- Ending Inventory: 4 × Rp5,000,000 = Rp20,000,000
Now let’s calculate the COGS:
COGS = Rp50,000,000 + Rp100,000,000 − Rp20,000,000 = Rp130,000,000
So, Abadi Company’s COGS is Rp130,000,000.
To calculate gross margin, subtract the COGS from the total revenue:
(26 × Rp8,000,000) − Rp130,000,000 = Rp78,000,000
ERP: What It Is, Why It Matters, and How Businesses Use ItThe Easy Way to Calculate COGS
Calculating COGS could be time-consuming, especially when done manually using spreadsheets, and dealing with varying purchase prices from multiple vendors.
But now, systems like Odoo make it easier than ever to calculate COGS automatically and in real-time.
With Odoo, businesses can:
- Automatically track inventory
- Record every purchase and material expense
- Integrate sales and production data
- Instantly calculate COGS without repetitive manual input
Thanks to its integrated accounting, inventory, and manufacturing modules, Odoo calculates COGS based on actual stock movements and full production costs.
As a result, companies can make faster, data-driven decisions with accurate financial insights.