Cost of Goods Sold Calculator

Cost of goods sold (COGS) is what you paid to acquire the merchandise you sold in a period, calculated as opening stock + net purchases during the period − closing stock. Net purchases are found by adding purchase expenses such as freight to the purchase amount and subtracting purchase returns and discounts. This tool calculates COGS, goods available for sale, gross profit, gross margin and inventory turnover together; enter all amounts excluding VAT.

Cost of Goods Sold

Cost of goods sold
—
—
Goods available for sale
—
—
Gross profit
—
net sales − cost of goods sold
Gross margin
—
gross profit ÷ net sales
Inventory turnover
—
—

Calculation formula

Net alış                 = Dönem içi alışlar + Alış giderleri − Alış iadeleri ve iskontoları
Satışa hazır mal          = Dönem başı stok + Net alış
Satılan malın maliyeti    = Satışa hazır mal − Dönem sonu stok

Brüt satış kârı           = Net satışlar − Satılan malın maliyeti
Brüt kâr marjı            = Brüt satış kârı ÷ Net satışlar × 100
Stok devir hızı           = Satılan malın maliyeti ÷ ((Dönem başı stok + Dönem sonu stok) ÷ 2)

What is cost of goods sold?

Cost of goods sold (COGS) is not the selling price but what you paid for the goods you sold during the period. It is the first item deducted from revenue when calculating profit: if you made ₺210,000 in sales in a month and bought the goods you sold for ₺140,000, your gross profit before expenses such as rent and payroll is ₺70,000.

The total of your purchases in the period is not your cost of goods sold. If you bought ₺150,000 of goods during the month and left some on the shelf, the remainder is not this month's expense but inventory carried over to next month. Opening and closing stock in the formula are there to correct for this difference.

Example: a quarterly calculation

A grocery store started the quarter with ₺40,000 of stock, bought ₺150,000 of goods during the quarter, paid ₺5,000 in freight for those purchases and returned ₺3,000 of goods to the supplier. The count at the end of the quarter showed ₺52,000 of goods on the shelf. Net sales were ₺210,000.

ItemCalculationAmount
Opening stock40.000 ₺
+ Net purchases150.000 + 5.000 − 3.000152.000 ₺
= Goods available for sale40.000 + 152.000192.000 ₺
− Closing stockcount52.000 ₺
= Cost of goods sold192.000 − 52.000140.000 ₺
Gross profit210.000 − 140.00070.000 ₺
Gross margin70.000 ÷ 210.000%33,33
Inventory turnover140.000 ÷ ((40.000 + 52.000) ÷ 2)3.04 times

Stock turned over 3.04 times in the quarter, meaning the goods on the shelf sold in about 30 days on average. To see turnover on an annual or monthly basis and in days, enter the cost of goods sold you found on this page into the inventory turnover calculator.

How do you find closing stock?

Closing stock is the one item in the formula you cannot estimate, and it drives the result most: if you under-record ₺5,000 of goods in the count, cost of goods sold comes out ₺5,000 too high and your profit ₺5,000 too low. Closing stock is found by multiplying the quantities counted on the last day of the period by their unit costs and adding them up. To record the count product by product, use the warehouse count inventory template; for a signed record, the stock count report is ready.

If you bought the same product at different prices during the period, "unit cost" is not a single number, and the price at which the remaining stock is valued depends on the method. To see cost of goods sold and the value of remaining stock batch by batch using the method that consumes the oldest purchases first, use the FIFO cost calculator; the tool also compares the same batches with the weighted average method. Agree with your accountant on which valuation method to use in your financial records.

Cost of goods sold table in Excel

You can track cost of goods sold and gross profit in Excel by opening one row for each month. Enter the month in column A, opening stock in B, purchases in C, purchase expenses in D, returns and discounts in E, the month-end count amount in F, and net sales in H:

G2 (satılan malın maliyeti):  =B2+C2+D2-E2-F2
I2 (brüt kâr):                =H2-G2
J2 (brüt kâr marjı):          =EĞERHATA(I2/H2;0)
B3 (sonraki ayın dönem başı): =F2

Drag G2, I2 and J2 down; format column J as a percentage. The B3 formula makes each month's closing stock the next month's opening stock — so you only type the opening stock of the first month by hand. This sheet uses IFERROR with commas as separators; in Turkish-language Excel the function is called EĞERHATA and the separator is a semicolon.

If you want to total the purchases column from a separate place, the monthly total of the "Merchandise Purchases" category in the income and expense tracking template is a good source; to keep purchases document by document, you can use the invoice tracking template.

Which items go into net purchases?

The basis of net purchases is the invoice amount, excluding VAT, of the goods you bought for resale during the period. Goods you returned to the supplier and discounts you received afterwards are deducted from this amount. Expenses directly tied to the purchase, such as freight paid to bring the goods to your warehouse, are generally added to the purchase cost; operating expenses such as rent, electricity and payroll are not part of cost of goods sold and are recorded under separate expense items.

Which expenses to add to cost and which accounts to use in your books is an accounting decision; confirm it with your accountant. The tool calculates with the amounts you specify.

This formula is for merchandise that you buy and sell as is. In a business that buys raw materials and manufactures products, the cost of finished goods sold includes labor and production overheads as well as raw materials; this tool does not do that calculation.

Cost of goods sold and pricing decisions

The ratio of cost of goods sold to net sales (66.67% in the example) shows how much of your revenue goes to the goods themselves; the remaining 33.33% has to cover rent, payroll and other expenses and leave a profit. If this ratio keeps rising from period to period, it means either your purchase prices are rising faster than your selling prices, shrinkage and losses are increasing, or the count is coming up short.

When setting the selling price of a single product, look at the latest purchase price rather than the period average: enter the latest purchase price and your target margin into the profit margin calculator.

Frequently asked questions

How is cost of goods sold calculated?

Cost of goods sold = opening stock + net purchases during the period − closing stock. For example, if you had ₺40,000 of stock at the start of the period, net purchases during the period were ₺152,000 and ₺52,000 of goods remained in the closing count, cost of goods sold is 40,000 + 152,000 − 52,000 = ₺140,000.

What is the cost of goods sold formula?

Opening stock + (purchases + purchase expenses − purchase returns and discounts) − closing stock. The part in parentheses is net purchases; the sum of opening stock and net purchases is called goods available for sale.

Are cost of goods sold and purchases the same thing?

No. Purchases are all the goods you bought during the period; cost of goods sold is only the portion of them that was sold. Goods left on the shelf carry over to the next period as closing stock and enter that period's cost.

Does cost of goods sold include VAT?

No. Purchases, returns, period stocks and sales are entered excluding VAT; VAT is tracked separately. You can use the VAT calculator to find the amount excluding VAT.

How is gross profit calculated?

Gross profit = net sales − cost of goods sold. With net sales of ₺210,000 and cost of goods sold of ₺140,000, gross profit is ₺70,000 and gross margin is 70,000 ÷ 210,000 = 33.33%. Operating expenses such as rent and payroll are deducted from this profit separately.

What does it mean if closing stock is larger than goods available for sale?

The formula gives a negative cost; this is always a data error. Usually a purchase invoice has not been entered, opening stock was recorded too low, or the unit cost was multiplied incorrectly in the count.

Can cost of goods sold be calculated per product?

Yes. The same formula works for a single product: that product's opening stock value + net purchases for that product − closing stock value. If you bought the product at different prices, the FIFO cost calculator works out the cost sold across batches.

Are the numbers I enter saved?

No. The calculation is done entirely in your browser; the amounts are not sent to any server.

Related calculators

FIFO Cost Calculator

Cost of goods sold and remaining stock using FIFO from purchase batches at different prices; a comparison with weighted average and LIFO.

Inventory Turnover

How many times a year does your stock turn over, in how many days does it sell out, and how much cash is tied up in the warehouse?

To keep this calculation in Excel

Warehouse Count / Inventory Excel

Compares the quantity in your system with the physical count and automatically reports shortages, surpluses and the value of the loss.

Income and Expense Table Excel

Totals income and expenses by category; calculates VAT, the grand total and net profit/loss automatically.

Search terms: cost of goods sold calculationhow to calculate cost of goods soldcost of goods sold formulawhat is cost of goods soldcost of goods sold tablecost of goods sold excelgross profit calculation

Last updated: October 5, 2026