Excel Margin Calculator
Use this tool the same way you would in a spreadsheet: enter any known values, then click the action you need.
=IFERROR((B2-A2)/B2,0) for margin and =IFERROR((B2-A2)/A2,0) for markup.If you are searching for a practical margin calculator in Excel, you are usually trying to answer one of three business questions:
- What margin am I making at my current selling price?
- What selling price should I set to hit a target margin?
- Given a fixed selling price, what is the maximum cost I can afford?
This page gives you both: a live calculator and a clean Excel setup you can copy directly into your workbook.
What margin means (and what it does not)
Margin is often confused with markup. They are related, but they are not the same number.
- Profit per unit = Selling Price - Cost Price
- Margin % = Profit / Selling Price
- Markup % = Profit / Cost Price
Because the denominator is different, margin % and markup % are always different unless profit is zero.
Step-by-step: build a margin calculator in Excel
1) Set up your columns
| Column | Header | Example Value |
|---|---|---|
| A | Cost Price | 25.00 |
| B | Selling Price | 40.00 |
| C | Profit | 15.00 |
| D | Margin % | 37.50% |
| E | Markup % | 60.00% |
2) Enter formulas in row 2
=C2: =B2-A2 =D2: =IFERROR((B2-A2)/B2,0) =E2: =IFERROR((B2-A2)/A2,0)
Format columns D and E as Percentage with 2 decimals. Then fill down for the rest of your product list.
3) Add target margin pricing formula
If your target margin is entered as a decimal (like 0.35), use:
=IFERROR(A2/(1-F2),0)
If your target margin is entered as a whole percent (like 35), use:
=IFERROR(A2/(1-F2/100),0)
Quick formula library for daily use
- Profit:
=B2-A2 - Margin %:
=IFERROR((B2-A2)/B2,0) - Markup %:
=IFERROR((B2-A2)/A2,0) - Selling price from target margin %:
=IFERROR(A2/(1-D2/100),0) - Allowable cost from selling price and target margin %:
=IFERROR(B2*(1-D2/100),0)
Common mistakes to avoid
Using markup when you mean margin
A 50% markup does not equal a 50% margin. For pricing strategy, this mistake can materially reduce profit.
Mixing percentage formats
In Excel, 35% equals 0.35. If your formula assumes 35 but your cell stores 0.35, the output will be wrong by a wide margin.
Forgetting IFERROR
If selling price or cost is zero, divide-by-zero errors appear. Wrap formulas with IFERROR to keep your sheet stable.
Practical example
Let’s say your unit cost is $18 and you want a 40% margin. Use:
=18/(1-40/100)
Excel returns $30.00, which means:
- Profit per unit = $12.00
- Margin = 40.00%
- Markup = 66.67%
When to use this in real business workflows
- Setting retail prices for new inventory
- Quoting services while protecting minimum margin thresholds
- Comparing supplier options based on margin impact
- Monthly profitability reviews by SKU or client
Final takeaway
A strong margin calculator in Excel gives you faster decisions and fewer pricing errors. If you track cost, selling price, and target margin consistently, your spreadsheet turns into a reliable pricing engine instead of a guesswork tool.