The formula
Gross profitExcelGoogle Sheets
=A2-B2In E2 → $14.00
Gross margin %ExcelGoogle Sheets
=(A2-B2)/A2In E3 → 35%
Net margin %ExcelGoogle Sheets
=(A2-B2-C2)/A2In 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.
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Price | Cost | Other costs | ||
| 2 | 40 | 26 | 6 | $14.00 | |
| 3 | 35% | ||||
| 4 | 20% | ||||
| 5 | 35% |
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.