Business

Profit margin formula in Excel

Margin = profit ÷ selling price. It can never exceed 100%.

All Excel versions and Google Sheets

The formula

Gross profitExcelGoogle Sheets
=A2-B2
In E2 → $14.00
Gross margin %ExcelGoogle Sheets
=(A2-B2)/A2
In E3 → 35%
Net margin %ExcelGoogle Sheets
=(A2-B2-C2)/A2
In E4 → 20%
Safe version for blank pricesExcelGoogle Sheets
=IFERROR((A2-B2)/A2,"")
In E5 → 35%
✓ Tested. All 4 Excel results in this example were recalculated in LibreOffice Calc 25.2 and matched the values shown.

Worked example

Paste the data below into a blank sheet starting at cell A1 (or download the cheat sheet, where every example is set up). Highlighted cells hold the formulas and show the expected results.

ABCDE
1PriceCostOther costs
240266$14.00
335%
420%
535%

How it works

A2-B2
Profit per unit.
/A2
Divide by price (not cost) for margin.
C2
Fees, shipping, ads per unit for net margin.

Common errors and fixes

Why does the formula return #DIV/0!?

Price is blank or 0. Use IFERROR.

Margin above 100%?

You divided by cost: that's markup.

Does this work in Google Sheets?

Yes. The formulas on this page work the same way in Google Sheets.