SpreadsheetFormulas
beginner

Calculate Gross Profit and Gross Margin

You have what each product cost to make or buy, and what it sold for. You need the profit in dollars per line — and the margin percentage next to it so lines are comparable.

Quick formula
=B2-A2
Sample input
1ProductCOGSRevenue
2Desk600010000
3Chair17502500
Result
1ProductGross ProfitMargin
2Desk400040%
3Chair75030%

Excel & Google Sheets

=B2-A2

This formula works in both Excel and Google Sheets.

How it works

With cost of goods in column A and revenue in column B, revenue minus cost is the gross profit — the dollars left after paying for the product itself, before rent, salaries, and marketing. Selling $10,000 of goods that cost $6,000 leaves $4,000. Dollars answer "how much did we make?", but they can't compare a $10,000 line against a $2,500 one — for that, add gross margin in the next column: =(B2-A2)/B2 divides the profit by revenue, giving 0.4 (40%) here. Together the pair shows which products earn the money and which earn it efficiently.

B2
Revenue — what the product sold for.
-A2
Minus cost of goods sold. The result is gross profit in dollars.
=(B2-A2)/B2
Optional next column: gross margin as a decimal — profit divided by revenue.

When to use it

Use it on any product, SKU, or service-line table to spot loss-makers, rank products by profitability, or feed a pricing review with real per-line numbers.

Common mistakes

  • Subtracting in the wrong order.

    =A2-B2 with cost in A gives cost minus revenue — profitable lines show negative. Revenue comes first: =B2-A2.

  • Dividing margin by cost instead of revenue.

    =(B2-A2)/A2 is markup (66.7% here), not gross margin (40%). Margin always divides by revenue — mixing them up overstates profitability.

  • Leaving shipping and payment fees out of cost.

    If freight or card fees live in another column, the "gross profit" is inflated. Fold every direct cost into column A, or subtract each: =B2-A2-C2.

Did this formula help?

Engine-verified against the sample data aboveDownload the proof sheet (.xlsx)Last reviewed 2026-07-09