How to Calculate Cost of Goods Sold: Inventory to Profit
Published by MyBreakeven. Editorial standards and corrections. Report a calculation or content issue to support@mybreakeven.com.
Calculate cost of goods sold from inventory, purchases and credits. Reconcile returns, costing methods, gross margin and cash with worked examples.

A large inventory purchase does not mean every purchased dollar became an expense this month. Some products remain on the shelf, some are returned to suppliers, and some may be damaged or missing. To calculate cost of goods sold correctly, reconcile those movements before using the result to judge a product margin or set a selling price.
This guide builds a periodic inventory calculation for a small retailer or ecommerce seller. It then connects that calculation to gross profit, order contribution and inventory cash. All USD figures are hypothetical examples. Manufacturing, tax inventory rules and service cost reporting can require different treatments; this worksheet is a management explanation rather than a filing method.
Quick answer: the cost of goods sold formula
Cost of goods sold = beginning inventory + net inventory additions − ending inventory, provided there are no separately recorded losses or other inventory movements to reconcile. For a simple reseller, net additions can include purchases and inbound freight, less supplier returns, allowances and discounts under the stated costing policy.
If beginning inventory is $12,000, net additions are $29,000 and ending inventory is $11,000, the simplified result is $30,000 COGS. Value both inventory balances at cost using a consistent method. Selling prices are not inventory cost. If stock was lost or written down separately, reconcile that adjustment rather than assuming every missing item was sold.
Gather the records before calculating
Choose the period first: one completed month, quarter or year. Use its opening and closing dates on every inventory report. Beginning inventory should reconcile to the previous period's ending inventory after any documented adjustment. Keep the same locations and ownership boundary in both counts.
| Input | Record | Check |
|---|---|---|
| Beginning inventory | Opening stock ledger at cost | Same costing method and locations as closing stock |
| Purchases received | Supplier invoices and receiving records | Receipt/ownership cutoff, not simply the bank payment date |
| Supplier credits | Returns, allowances and discount records | Deduct each adjustment once |
| Inbound freight | Carrier and landed-cost records | Do not add freight already inside the purchase/stock cost |
| Ending inventory | Counted units and unit costs | Investigate damaged, missing and returned stock |
| Other movements | Write-offs, transfers and owner withdrawals | Explain movements outside ordinary sales |
A purchase order alone is not proof stock belongs in the period. Goods in transit, consigned stock and returns awaiting inspection need a consistent ownership and cutoff policy. If stock is kept by a fulfillment provider, reconcile its units with your own ledger; do not omit it just because it is outside your building. Transfers between your own included locations should not become new purchases twice.
Worked example: purchases are not the same as COGS
Assume the period begins with $12,000 inventory at cost. Supplier purchases are $30,000, supplier returns are $1,500, recognized purchase discounts are $500 and additional inbound freight is $1,000. None of those adjustments is already included in another line. There are no separately recorded losses, manufacturing costs or owner withdrawals in this first example.
| Line | Calculation | Amount |
|---|---|---|
| Beginning inventory | Opening stock at cost | $12,000 |
| Net additions | $30,000 − $1,500 − $500 + $1,000 | $29,000 |
| Goods available | $12,000 + $29,000 | $41,000 |
| Ending inventory | Counted remaining stock at cost | $11,000 |
| COGS | $41,000 − $11,000 | $30,000 |
The business purchased $30,000 of merchandise, but that coincidence does not make purchases a substitute for the calculation. Change closing inventory to $14,000 while holding the other inputs unchanged and COGS becomes $27,000. Change it to $8,000 and the simplified inventory outflow becomes $33,000. Investigate why the stock balance changed before describing all of that difference as additional sales.
Now suppose sales before customer discounts and refunds were $50,000. Customer refunds reduce sales by $3,000 and discounts by $2,000, leaving $45,000 net sales. With the first $30,000 COGS result, gross profit is $15,000 and gross margin is $15,000 ÷ $45,000 × 100 = 33.33%. That is not net profit or available cash.
Separate supplier returns, customer refunds and shipping costs
Supplier returns and customer returns are different transactions. A supplier credit reduces the purchase cost or other relevant inventory amount under your records. A customer refund reduces sales revenue. A customer-returned item may also return to inventory at an appropriate recoverable cost after inspection; a refund by itself does not prove the product is saleable again.
If inspected customer-returned stock is already included in the $11,000 ending balance, do not deduct its recovered inventory cost a second time from the worksheet. If the product is destroyed, retain evidence of the loss and apply your reporting policy consistently. Return labels, inspection work and unrecovered payment charges are additional costs with their own boundaries.
In this reseller worksheet, inbound freight brings goods into inventory. Shipping the completed order to a customer is tracked separately for the contribution comparison. A company's financial-statement classification may differ, so name the boundary on the report. The return-cost guide explains how refunded sales, recovered stock and unrecovered operating costs interact.
Do not automatically put every warehouse, advertising or payment expense into the purchase line. Equally, do not assume COGS is always variable: a manufacturer can assign production labor and overhead to goods. Its work-in-process and finished-goods reconciliation needs more than the basic reseller formula. The gross-versus-contribution guide shows why the classifications can cross.
Handle missing stock without counting the loss twice
Suppose the first example's records identify $500 inventory cost lost through damage, and the reporting policy presents that loss separately from sold-goods cost. The inventory movement becomes $41,000 − $29,500 sold-goods cost − $500 loss = $11,000 ending stock. Sold-goods cost is $29,500 in that presentation, not $30,000 plus another $500 loss.
If the $500 is instead already included within a $30,000 COGS line, do not subtract another $500 expense when reconciling the same inventory movement. The combined cost remains $30,000 in these two simplified presentations. This is an arithmetic boundary check, not a recommendation for where a particular loss must appear on a tax return or financial statement.
Separate physical count discrepancies from unit-cost discrepancies. Ten missing units and an outdated cost assigned to ten present units are different problems. Recount expensive items, check unit packs, review transfers and compare the receiving cutoff before changing a margin target. Keep adjustments documented so the next opening balance is traceable.
FIFO and weighted-average costing can change the result
Consider an independent example with 100 opening units costing $8 each and 100 new units costing $10 each. There are 200 units and $1,800 cost available. The business sells 150 units and retains 50; there are no returns or losses.
| Method | Cost assigned to 150 sold units | Ending inventory |
|---|---|---|
| FIFO | 100 × $8 + 50 × $10 = $1,300 | 50 × $10 = $500 |
| Periodic weighted average | 150 × ($1,800 ÷ 200) = $1,350 | 50 × $9 = $450 |
Each route reconciles to the same $1,800 total cost. The $50 COGS difference changes reported gross profit by $50 when sales are identical. A perpetual moving average can differ when purchase and sale dates interleave; this table specifically uses a periodic average over all units available.
Do not switch methods just to make a weak month look better or assign different cost bases to opening and closing stock. Method selection and changes have reporting and tax implications. Use the policy appropriate to your records and get qualified guidance for a filing decision. This article does not choose a tax inventory method for your business.
Copy a COGS worksheet into Excel or Google Sheets
Put beginning inventory in B2, purchases in B3, supplier returns/allowances in B4, recognized purchase discounts in B5, additional inbound freight in B6 and ending inventory in B7. For the simple reseller case with no other movements:
- Net additions in B8:
=B3-B4-B5+B6. - Goods available in B9:
=B2+B8. - COGS in B10:
=B9-B7. - Net sales in B11; gross profit in B12:
=B11-B10. - Gross margin in B13:
=IF(B11>0,B12/B11,NA()), formatted as a percentage.
These are copyable instructions, not a downloadable file or a new calculator. Add a separate reconciliation for other inventory movements instead of silently forcing them into purchases. A negative COGS result needs investigation of credits, cutoff, valuation and adjustments; it should not be accepted as proof that selling products creates negative cost.
Keep source references beside the cells and preserve the completed month's version. If you later correct a count, explain the change and reconcile the following opening balance. Rounding displayed currency to cents should not mean rounding every unit cost before multiplying a large quantity.
Connect COGS to contribution and the inventory cash requirement
Continue the first example: $45,000 net sales minus $30,000 COGS leaves $15,000 gross profit. Assume this reseller's $30,000 COGS varies with sold volume and contains no fixed production allocation. Suppose $4,000 variable selling costs are not already included in COGS, and monthly fixed operating expenses are $8,000. Contribution is $11,000 and operating profit under these assumptions is $3,000. Interest, taxes and any unentered owner-compensation requirement still need an explicit reconciliation.
At a stable $11,000 ÷ $45,000 = 24.4444% contribution ratio, the $8,000 fixed-cost operating threshold is $8,000 ÷ (11,000 ÷ 45,000) = $32,727.27, rounded for display. This requires the same cost mix and realistic demand. Enter consistent order-level costs in the existing ecommerce break-even calculator; it does not import this inventory ledger.
Inventory cash follows payment dates, while COGS follows the cost assigned to goods sold. Paying a supplier today for stock that remains unsold uses cash without creating the same immediate sold-goods expense. Selling stock bought in a prior month can create COGS without a new purchase payment that month. Use the reorder-point cash guide for the replenishment decision and the working-capital guide for the balance-sheet position.
Finish the month with a reconciliation you can repeat
- Match the opening balance to the prior close.
- Reconcile units received, sold, returned, transferred and lost.
- Check supplier credits and landed costs for duplicate entries.
- Value closing stock under the stated method and document count corrections.
- Reconcile gross profit to contribution and operating profit with each cost counted once.
- Review stock aging and payment dates alongside the margin result.
The result is useful when another person can follow each input back to a record. For the complete store reconciliation, continue with ecommerce profit margins after fees and overhead. For the cost of stock that remains unsold, use inventory holding cost per SKU.
Sources and calculation scope
The examples and spreadsheet layout were constructed for this guide. Pearson's COGS reference describes inventory reconciliation and cost-flow approaches. OpenStax explains inventory costing. For US filing rules rather than this management worksheet, consult the applicable IRS Publication 334 and a qualified adviser. Source methods do not supply our hypothetical amounts.
Frequently asked questions
What is the basic cost of goods sold formula?
For a simple reseller with no separately recorded inventory movements, COGS equals beginning inventory plus net additions minus ending inventory. Reconcile losses, transfers and other adjustments before treating the full stock outflow as sold-goods cost.
Are purchases the same as cost of goods sold?
No. Purchases add stock, while COGS measures cost assigned to goods sold. Unsold inventory remains in the closing balance, and supplier credits or landed costs can change net additions.
Should inventory be valued at selling price?
No. Use the appropriate consistent cost valuation for this worksheet. Selling prices belong in the sales calculation; mixing retail value with purchase cost produces a misleading COGS result.
How do customer returns affect COGS?
A refund reduces sales revenue, while inspected recoverable goods may return to inventory at an appropriate cost. If the returned stock is already included in closing inventory, do not deduct its recovered cost again.
Does COGS include delivery and advertising?
This reseller example tracks outbound fulfillment and advertising separately for contribution. Financial-statement classifications can differ; state your policy, and include each cost once rather than assuming every business uses the same boundary.
Can I estimate COGS without a stock count?
An estimate based on a cost ledger or historical gross margin can be useful provisionally, but it is not a verified physical count. Identify the estimate, its assumptions and the later reconciliation instead of treating an old margin percentage as proof.
Does a lower COGS percentage mean more available cash?
Not necessarily. Gross margin can improve while cash is tied up in unsold stock or receivables. Review purchase payments, collection dates and inventory movements alongside the margin.
Can service businesses use this inventory formula?
Only for a relevant inventory component with matching records. A pure service cost-of-sales calculation usually needs its own labor and delivery-cost boundary rather than pretending all service expenses flow through merchandise stock.
Browse the MyBreakeven blog hub for related planning guides.
Planning estimates only—not accounting, tax, legal or lending advice.