Profit margin tells you what percentage of your revenue is actually profit after costs. Excel calculates it in one formula โ no separate add-in or complex model required โ as long as you know your revenue and your cost.
This guide from Anchor AI Tools covers the exact formula, the difference between margin and markup (a mix-up that leads to real pricing mistakes), and a worked example across multiple products.
Quick Answer: To calculate margin in Excel, subtract cost from revenue, then divide by revenue: =(B2-C2)/B2, where B2 is revenue and C2 is cost. Format the result as a percentage. For example, a product that sells for $80 and costs $50 has a margin of 37.5%.
=(Revenue - Cost) / Revenue
Format the result as a percentageIn plain terms: Margin % = Profit รท Revenue. It answers "of every dollar I bring in, how much is actually profit?" โ which is different from asking how much profit is relative to cost (that's markup, covered below).
=(B2-C2)/B2.A small retailer wants to check the margin on three products.
| Product | Revenue ($) | Cost ($) | Margin |
|---|---|---|---|
| Product A | 80 | 50 | 37.5% |
| Product B | 120 | 90 | 25.0% |
| Product C | 45 | 18 | 60.0% |
๐ Formula Used
With revenue in B2 and cost in C2, copied down each row:
Even though Product C brings in less revenue than Product A or B, it has by far the best margin โ 60% of every dollar it earns is profit, compared to 25% for Product B. Margin often tells a different story than revenue alone.
| Type | What It Includes | Excel Formula |
|---|---|---|
| Gross Margin | Revenue minus direct cost of goods sold (COGS) only | =(Revenue-COGS)/Revenue |
| Net Margin | Revenue minus all costs โ COGS, overhead, taxes, interest | =NetIncome/Revenue |
Gross margin is useful for pricing individual products. Net margin gives the full picture of business profitability once every expense is accounted for โ the two numbers can look very different for the same business.
Margin and markup use the same two numbers โ revenue and cost โ but divide by a different base, and mixing them up is one of the most common small-business pricing mistakes.
Margin = Profit รท Revenue ยท Markup = Profit รท Cost
Same profit amount, different denominator, very different percentagesUsing the Product A example above ($80 revenue, $50 cost, $30 profit): margin is 30 รท 80 = 37.5%, but markup is 30 รท 50 = 60%. Pricing a product to hit a "50% margin" by simply adding 50% to cost actually only produces a 33.3% margin โ a mistake that quietly erodes profitability across every sale.
Dividing by cost instead of revenue. This calculates markup, not margin โ the two numbers are not interchangeable, and using the wrong one in a pricing decision compounds across every sale.
Forgetting to format as a percentage. A margin formula without percentage formatting shows a confusing decimal like 0.375 instead of 37.5%.
Mixing gross and net margin without labeling which one you mean. A "40% margin" claim is meaningless without specifying gross or net โ they can differ substantially.
Using negative or zero revenue. If revenue is zero, the formula returns a #DIV/0! error โ wrap it in IFERROR if you're calculating margin across many rows that might include blanks.
This comes up constantly for small business owners setting or reviewing prices, freelancers and agencies checking project profitability, e-commerce sellers comparing product performance, and finance teams building pricing or budgeting models.
Also checking a typical value in your sales data? See our guide on how to calculate median in Excel. Need a quick percentage calculation instead of a full spreadsheet? Try our percentage calculator.
Need more free calculators and formula guides?
Explore Free Tools โ=(Revenue-Cost)/Revenue, formatted as a percentage. For example, =(B2-C2)/B2 with revenue in B2 and cost in C2.=(Revenue-COGS)/Revenue.Percentage Calculator
Calculate percentage increase, decrease, and discounts.
Median in Excel
Find the typical value in a dataset with outliers.
P-Value in Excel
Test whether a difference in your data is statistically significant.
Excel Ran Out of Resources
7 fixes for this common calculation error.
Mortgage Calculator
Estimate monthly payments with taxes and insurance.
We build free, fast, and accurate online tools and guides that explain the answer โ not just show a number. Used by small business owners, analysts, and freelancers every day.
Published by Anchor AI Tools ยท ยฉ 2026 Anchor AI Tools