How to calculate profit margin percentage in Excel
Formula (Excel and Google Sheets)
=(B2-C2)/B2Divide profit by revenue: =(B2-C2)/B2, where B is the price or revenue and C the cost.
- Result on the example
- one result per row in
D2, filled down toD5 - Works in
- Every current version
- Google Sheets
- Same formula
See it work
The formula is already in D2, filled down to D5. Change any input and the result updates, or edit the formula to experiment.
How it works
Margin is profit divided by the selling price: the share of each sale you keep. The brackets make Excel subtract before dividing. Markup is different: it divides profit by cost, so the same product has a higher markup than margin.
=(B2-C2)/B2Result0.4623655914
B2$39.99The value in B2.
C2$21.50The value in C2.
B2-C218.49The - operator subtracts.
B2-C2)/B20.4623655914The / operator divides.
In Google Sheets
The same formula works in Google Sheets: =(B2-C2)/B2. We ran it in Google Sheets mode on the same data and it returns the same results.
Other ways to do it
Each one was run on the same example sheet.
| Formula | Result | When to use it |
|---|---|---|
| =1-C2/B2 | 46.2%, 34.9%, 33.0%… | The same margin: one minus the cost share of the price. |
| =(B2-C2)/C2 | 86.0%, 53.7%, 49.2%…Different result | Markup, not margin: profit as a percentage of cost. Markup is higher than margin for the same product. |
Common mistakes
- Mixing up margin and markup is the most common pricing mistake. A 50% markup is only a 33.3% margin.
- To set a price from a target margin, divide the cost by (1 - margin):
=C2/(1-40%).
Try it yourself
Same data, empty answer cell. Your formula is graded instantly, then re-checked on changed data, so a typed-in number won't pass.
Calculate profit margin percentage
D2, calculate the profit margin (profit as a percentage of the price) and fill down to D5.Questions
What is the difference between margin and markup?
Margin divides profit by price; markup divides profit by cost.
How do I calculate gross margin for a whole report?
Use totals: =(SUM(B2:B5)-SUM(C2:C5))/SUM(B2:B5), not the average of the row margins.
Checked by running on 2026-10-29: every formula and result on this page was calculated by the Spreadsheet Practice formula engine, in both Excel and Google Sheets modes.