Excel Formula for Profit Margin (2026): Gross, Net, Markup & Target Price + Free Template

Excel Formula for Profit Margin: a young entrepreneur organizing cash, receipts and a budget notebook

Quick summary: The Excel formula for profit margin is =(B2-C2)/B2, with the selling price in B2 and the cost in C2. Format the cell as a percentage, so 0.6 shows as 60%. Use =IFERROR((B2-C2)/B2,"") to avoid #DIV/0! errors. The same formulas work in Google Sheets.

Jump to a section (17)
  1. What is the Excel formula for profit margin?
  2. Which profit margin formulas do you need?
  3. How do you calculate margin in Excel vs markup?
  4. How do you find the price for a target margin in Excel?
  5. How do you calculate the overall margin for many products?
  6. How do you calculate gross, operating and net profit margin in Excel?
  7. What other margin formulas come up in Excel?
  8. What are the most common profit margin formula mistakes in Excel?
  9. Does the profit margin formula work in Google Sheets?
  10. How do you use the free profit margin template?
  11. Where do these numbers and rules come from?
  12. How do you calculate a 30% profit margin?
  13. What is the formula for profit percentage?
  14. Checklist: can you trust your margin column?
  15. What would I tell a friend about the profit margin formula in Excel?
  16. Frequently asked questions
  17. Related guides
Your first step today

Do this today

Put your selling price in B2 and cost in C2, enter =(B2-C2)/B2, and format it as a percentage.

Start small. Your first goal is $500 a month. That is where I started. — Trent

Get the free Startup Kit

Five free files: a startup checklist (PDF), a one-page business plan (Word and PDF), a full plan template (Word), a financials workbook (Excel), and a startup cost worksheet (Excel). Enter your email and the downloads open on the next page. No credit card.

Free Startup Kit signup

Part of our business money basics. Formulas tested in Excel-compatible software and checked against Microsoft and Google documentation on November 22, 2026.

This guide gives you a copy-ready Excel formula for profit margin, plus the formulas for markup, gross, operating, EBITDA and net margin, the overall margin across many products, and the price you need for a target margin. Every formula is in our free profit margin template (.xlsx), filled in with worked examples.

What is the Excel formula for profit margin?

Profit margin is profit divided by the selling price. In Excel, subtract the cost from the price, then divide by the price:

  1. Put the selling price in B2 and the cost in C2.
  2. In D2, type =(B2-C2)/B2 and press Enter.
  3. Select D2 and click Percent Style on the Home tab, or press Ctrl+Shift+%. Microsoft’s guide to formatting numbers as percentages explains the options.
  4. Drag the fill handle down to copy the formula to every product row.

Example: a mug sells for $18.00 and costs $7.20. Profit is $10.80, and $10.80 ÷ $18.00 = 0.6, which displays as 60%.

The parentheses matter. Without them, =B2-C2/B2 divides first and returns 17.6 instead of 60%. Microsoft’s page on calculating percentages uses the same part-divided-by-total pattern.

Which profit margin formulas do you need?

These formulas assume price in B, cost in C, and units sold in G, as laid out in the template.

What you wantExcel or Google Sheets formulaMug example
Profit per unit=B2-C2$10.80
Profit margin %=(B2-C2)/B260%
Margin, no #DIV/0!=IFERROR((B2-C2)/B2,"")60%
Markup %=(B2-C2)/C2150%
Margin from markup=F2/(1+F2)60%
Markup from margin=E2/(1-E2)150%
Price for a target margin=C2/(1-H2)$18.00 at 60%
Gross profit for a row=(B2-C2)*G2$432 on 40 mugs

IFERROR in Excel and IFERROR in Google Sheets return the second value when the formula errors, such as when the price cell is empty or zero. If you’d rather see a label, use =IF(B2=0,"No sales",(B2-C2)/B2).

How do you calculate margin in Excel vs markup?

Margin divides profit by the price. Markup divides the same profit by the cost. The mug has a 60% margin but a 150% markup. Label your columns clearly, because a “40% margin” and a “40% markup” lead to very different prices. Our markup vs margin guide explains when to use each, and the markup calculator has its own Excel formulas.

How do you find the price for a target margin in Excel?

Divide the cost by 1 minus the target margin: =C2/(1-H2), with the target margin in H2 as a percentage. A $10 cost at a 40% target margin needs a $16.67 price.

A common mistake is adding the margin percentage to the cost. The template’s Target price sheet shows the gap:

Target marginRight price: cost ÷ (1 − margin)Wrong price: cost × (1 + margin)Margin you’d actually get
20%$12.50$12.0016.7%
30%$14.29$13.0023.1%
40%$16.67$14.0028.6%
50%$20.00$15.0033.3%
60%$25.00$16.0037.5%
70%$33.33$17.0041.2%

All examples use a $10 unit cost.

Motivational sign: One more call. One more sale.
Sales come from follow-ups. Make one more.

How do you calculate the overall margin for many products?

Don’t average the margin column. A simple average gives every product equal weight, even if one sells far more than another. Divide total gross profit by total revenue instead, or use SUMPRODUCT in one cell:

=SUMPRODUCT(G2:G6,B2:B6-C2:C6)/SUMPRODUCT(G2:G6,B2:B6)

SUMPRODUCT in Excel and SUMPRODUCT in Google Sheets multiply the matching rows, then add them up. In the template’s five-product example:

ProductPriceCostMarginUnitsRevenueGross profit
Mug$18.00$7.2060.0%40$720$432.00
Candle$24.00$9.0062.5%25$600$375.00
Tote bag$30.00$12.5058.3%15$450$262.50
Art print$40.00$14.0065.0%10$400$260.00
Sticker$4.00$0.9077.5%120$480$372.00
Total64.2%$2,650$1,701.50

The weighted margin is $1,701.50 ÷ $2,650 = 64.2%. The simple average of the five margins is 64.7%, which overstates it, because the high-margin stickers bring in only $480 of revenue.

How do you calculate gross, operating and net profit margin in Excel?

For a whole business, use one period’s totals from your profit and loss statement. With revenue in B5 and the other lines below it, as on the template’s P&L margins sheet:

MarginFormulaExcel exampleResult
Gross margin(Revenue − COGS) ÷ Revenue=(B5-B6)/B555.0%
Operating marginOperating income ÷ Revenue=B9/B520.0%
EBITDA margin(Operating income + D&A) ÷ Revenue=(B9+B10)/B522.5%
Net profit marginNet income ÷ Revenue=B14/B514.6%

The example uses $120,000 of revenue, $54,000 cost of goods sold, $42,000 operating expenses including $3,000 depreciation and amortization, $2,000 interest and $4,500 income taxes. That gives $66,000 gross profit, $24,000 operating income, $27,000 EBITDA and $17,500 net income. Build the statement itself with our profit and loss statement guide.

What other margin formulas come up in Excel?

How much does a discount cut the margin?

Apply the discount to the price first: =(B2*(1-I2)-C2)/(B2*(1-I2)), with the discount in I2. A 10% discount on the $18 mug drops the price to $16.20 and the margin from 60% to 55.6%.

How do you include a percentage platform fee?

Take the fee off the price before subtracting cost: =(B2*(1-J2)-C2)/B2, with the fee rate in J2. A 6.5% fee on the mug costs $1.17 and cuts the margin from 60% to 53.5%.

How do you find margin from profit and cost only?

Price is profit plus cost, so use =D2/(D2+C2). For the mug, $10.80 ÷ ($10.80 + $7.20) = 60%.

How much revenue do you need for a profit goal?

Divide the gross profit goal by your margin: =K2/E2. At the template’s 64.2% weighted margin, a $5,000 gross profit goal needs about $7,790 in sales. To cover fixed costs as well, use the break-even calculator.

Does the highest margin make the most profit?

Not always. In the template, stickers have the highest margin at 77.5% but bring in $372 of gross profit, while mugs at 60% bring in $432 because each sale makes more dollars. Sort by the Gross profit column as well as Margin % before you cut or promote a product.

What are the most common profit margin formula mistakes in Excel?

  • Dividing by cost. That’s markup, not margin.
  • Missing parentheses. =B2-C2/B2 divides before it subtracts.
  • Multiplying by 100 and formatting as a percent. =(B2-C2)/B2*100 formatted as a percentage shows 6000%. Use one or the other. Microsoft notes that the Percentage format multiplies the cell value by 100.
  • Averaging margins. Use total profit ÷ total revenue or SUMPRODUCT.
  • Leaving out costs. Unit cost should include shipping in, packaging and platform fees, or your margin looks better than it is. Our pricing calculator walks through full costs.
  • Hiding losses. A negative margin, such as −25%, means you sold below cost. Don’t wrap it in IFERROR or format it away.

Does the profit margin formula work in Google Sheets?

Yes. Every formula on this page works the same way in Google Sheets, including IFERROR and SUMPRODUCT. To format a percentage in Sheets, select the cells and choose Format, then Number, then Percent. To use the template, upload the .xlsx file to Google Drive and open it with Google Sheets.

How do you use the free profit margin template?

Download the profit margin template (.xlsx). It has four sheets:

  • Product margins: price, cost, profit, margin and markup for each product, with weighted and SUMPRODUCT totals.
  • Target price: the price needed for margins from 20% to 70%, next to the wrong add-the-percentage price.
  • P&L margins: gross, operating, EBITDA and net margin from your period totals.
  • How to use: short instructions.

Blue cells are inputs and black cells are formulas. If you’d rather not use a spreadsheet, the profit margin calculator and gross margin calculator do the same math in your browser.

Where do these numbers and rules come from?

For the profit margin formula in Excel, I keep these official sources bookmarked: IRS Publication 334, Tax Guide for Small Business, SBA guide to marketing and sales, and SBA guide to calculating startup costs. Those are the sources that matter for the profit margin formula in Excel when a blog and an official page disagree. Use the official page.

How do you calculate a 30% profit margin?

Divide the cost by 0.70. For a 30% profit margin, the price is cost ÷ (1 − 0.30). In Excel, with the cost in C2, type =C2/(1-0.3), or =C2/(1-H2) with 30% in H2. A $10 cost needs a $14.29 price: profit is $4.29, and $4.29 ÷ $14.29 = 30%.

Don’t add 30% to the cost. $10 × 1.3 = $13 gives you only a 23.1% margin, which is the gap shown in the target price table above.

What is the formula for profit percentage?

It depends on what you divide by. Profit margin divides profit by the selling price: =(B2-C2)/B2. “Profit percentage” in many school math books divides profit by the cost, which is markup: =(B2-C2)/C2. For the $18 mug that costs $7.20, the margin is 60% and the profit percentage on cost is 150%.

Neither one is wrong, but they answer different questions. Use margin when you compare products or read a P&L, and markup when you set a price from cost. Microsoft’s guide to calculating percentages in Excel uses the same divide-then-format approach.

Checklist: can you trust your margin column?

The top results show you the formula. They don’t show you how to check the sheet once it’s full of real products. Run these six checks before you make a pricing decision from it.

CheckWhat goes wrongHow to check it in Excel
Price is what you actually got paidDiscounts and coupons make the real margin lowerUse the net price column, not the list price
Cost includes freight-in, packaging, and platform feesMargin looks better than it isAdd a column for each cost and sum them in C
Percent format is not stacked on ×10060% shows as 6000%Remove *100 when the cell is formatted as a percentage (Microsoft)
Overall margin is weightedAveraging row margins ignores volumeUse =SUMPRODUCT(B2:B50-C2:C50,G2:G50)/SUMPRODUCT(B2:B50,G2:G50)
Negative margins stay visibleIFERROR or custom formats can hide a lossAdd conditional formatting that turns anything below 0% red
Blank rows return blank, not an error#DIV/0! breaks totalsWrap with =IFERROR((B2-C2)/B2,””)

What would I tell a friend about the profit margin formula in Excel?

Years in an aerospace machine shop taught me to measure twice. That habit is how I treat the profit margin formula in Excel. Use one formula and stick to it, with costs in their own cells so you can change them later. The value of the sheet is that you can see what happens to margin when a supplier raises a price.

— Trent Powell

Read next: the profit margin calculator, markup vs. margin, and gross vs. net profit, or go back to all money guides.

Frequently asked questions

Which Excel formula should I use for profit margin?

Use profit divided by revenue, like =(price-cost)/price, and format it as a percentage. Keep price and cost in their own cells so you can change them. That is margin. Markup is profit divided by cost, which is a different formula.

What is the formula for profit margin percentage in Excel?

Use =(B2-C2)/B2, with price in B2 and cost in C2, then format the cell as a percentage. For net profit margin from a P&L, divide net income by revenue, such as =B14/B5.

How do I calculate a 30% margin in Excel?

Divide the cost by 0.7: =C2/(1-30%). A $10 cost needs a $14.29 price for a 30% margin. Multiplying the cost by 1.3 gives $13.00, which is only a 23.1% margin.

How do I calculate gross profit margin in Excel?

Subtract cost of goods sold from revenue and divide by revenue: =(B5-B6)/B5. With $120,000 revenue and $54,000 COGS, gross margin is 55%.

Why does my margin formula show #DIV/0!?

The price or revenue cell is empty or zero, so Excel can’t divide. Wrap the formula in IFERROR, such as =IFERROR((B2-C2)/B2,""), to show a blank instead.

Can profit margin be more than 100%?

No. Margin is a share of the price, so it tops out at 100% when cost is zero. If you see more than 100%, you are probably dividing by cost, which is markup.

How do I calculate my profit margin?

Subtract your cost from your selling price, then divide by the selling price. In Excel, with price in B2 and cost in C2, use =(B2-C2)/B2 and format the cell as a percentage. For the whole business, divide net income by revenue for the same period.


General information, not accounting advice. Sources checked November 23, 2026: Microsoft: Calculate percentages, Microsoft: Format numbers as percentages, Microsoft: IFERROR, Microsoft: SUMPRODUCT, Google Sheets: IFERROR, Google Sheets: SUMPRODUCT. Last reviewed November 23, 2026.