Profit Margin Formula

Profit margin is profit as a share of the selling price; markup is profit as a share of the cost. They are easy to mix up, and they give different percentages for the same sale.

Free, no sign-up required · 5 free generations a day

Last updated

Describe your task, get the formula

Type what you need in plain English, or pick an example below. You get the formula, a step-by-step explanation, and a worked example.

Margin and markup formulas

Syntax
=(price - cost) / price
=(price - cost) / cost
=cost / (1 - target_margin)

The first formula is gross profit margin, the second is markup, and the third gives the selling price needed to reach a target margin. Format the results as percentages.

Examples

Gross profit margin

=(B2-A2)/B2

With a cost of 60 in A2 and a price of 100 in B2, profit is 40 and the margin is 40% of the price.

Markup on cost

=(B2-A2)/A2

For the same sale the markup is 40 out of a cost of 60, which is about 66.7%. A 40% margin is therefore a 66.7% markup.

Selling price for a target margin

=A2/(1-C2)

If the cost in A2 is 60 and the target margin in C2 is 40%, the price is 100. Do not multiply the cost by 1.4: that sets a 40% markup, not a 40% margin.

Common mistakes and how to fix them

Margin and markup are mixed up

Margin divides profit by the price and markup divides it by the cost. For any profitable sale the markup is the larger number, so check which one your report or supplier expects.

The result is a decimal such as 0.4

Apply the Percent number format. The value is correct; it is only shown as a fraction.

#DIV/0! on rows with no price

Wrap the formula: =IF(B2=0,"",(B2-A2)/B2) to leave rows without a price empty.

Frequently asked questions

What is the difference between gross and net margin?

Gross margin only subtracts the direct cost of the goods. Net margin subtracts all expenses, such as rent, salaries, and taxes, so it uses total profit in place of price minus cost.

How do I calculate margin for a whole column of sales?

Use total revenue and total cost, not an average of each row's margin: =(SUM(B2:B100)-SUM(A2:A100))/SUM(B2:B100).

Does it work in Google Sheets?

Yes. These are plain arithmetic formulas and work the same in Excel and Google Sheets.

Don't want to write it by hand?

Describe what you need in plain English and get a ready-to-use formula in seconds.

Try the formula generator