Profit Margin Calculator in Excel: Margin vs Markup and Discount Impact (Free)

A profit margin calculator in Excel takes a unit cost and a selling price and gives you the gross profit, the gross margin and the markup. The free calculator below also works out the price you need for a target margin and shows what a discount really costs you. In the sample coffee company, a 10% discount on one product cuts the margin from 41.7% to 35.2% and needs 31.6% more sales to earn the same profit.

Free download

Profit Margin Calculator practice and solution files (.zip)

Working formulas, sample data and a How to use sheet. Opens in Excel, or import it into Google Sheets.

Download free (.xlsx)

Watch the full step-by-step video:

Margin is not markup

Gross margin is the profit divided by the selling price. Markup is the same profit divided by the cost. They use the same ten dollars of profit but give different percentages, and mixing them up is how many small businesses end up charging too little.

Take a product that costs 20.00 and sells for 30.00. The profit is 10.00. That is a 50% markup, but only a 33.3% margin. If you add 50% to every cost and then plan your budget as if you had a 50% margin, you come up short on every sale. For a wider look at the formulas, see the profit margin formula guide.

What is inside the free profit margin calculator

The download is a zip with two files. The practice file has the layout and the yellow input cells, but every result cell is empty so you can build the formulas yourself. The solution file has every formula in place. Both open in Excel with no macros and no add-ins, and the sample figures are made up for a small US coffee roaster with twelve products.

The sheet has five parts: one margin versus markup example, a price calculator for a target margin, a product price list, a flag for products under target, and a discount impact table. Three cards at the top show the overall gross margin (57.0%), the number of products below target (4) and the margin at 10% off (35.2%).

Profit Margin and Markup Calculator in Excel with sample coffee company data
Snapshot 1: the finished calculator with the three summary cards, the example, the target price box and the product list.

This is educational content and not financial advice. The sample business is invented, so use your own costs and prices.

How to build the profit margin calculator step by step

Step 1: Gross profit, margin and markup for one product

The unit cost is in B6 and the selling price is in B7. First the gross profit per unit in B8:

=B7-B6

That gives 10.00. Then the gross margin in B9:

=IF(B7=0,"",B8/B7)

That gives 33.3%. The IF test keeps the cell empty while the price is still blank, so you never see a divide by zero error. The markup in B10 uses the cost as the divisor:

=IF(B6=0,"",B8/B6)

That gives 50.0%.

Step 2: Find the price for a target margin

This is the more useful question. With a unit cost of 12.40 in D6 and a target margin of 45% in D7, the price is the cost divided by one minus the margin. In D8:

=IF(D7>=1,"Margin must be below 100%",D6/(1-D7))

The answer is 22.55. After a 45% margin comes out of the price, the remaining 55% has to pay for the cost, which is why the formula divides by 1 minus the margin. The IF shows a message instead of a wrong price if someone types 100% or more.

Margin versus markup example and price for a target margin in Excel
Snapshot 2: the margin versus markup example next to the target price calculator.

Two more cells close the loop. The same target as a markup in D9 is =IF(D7>=1,"",D7/(1-D7)), which shows 81.8%. A check in D10, =IF(ISNUMBER(D8),(D8-D6)/D8,""), returns 45.0%, exactly your target. So a 45% margin needs a markup of almost 82%.

Step 3: Build the product price list

The list has 12 products from row 16 to row 27, each with a unit cost, a selling price and the units sold in the month. The target margin in B13 is 45%. In row 16 you enter these formulas and fill them down:

  • F16 gross profit per unit: =IF(A16="","",D16-C16)
  • G16 gross margin: =IF(OR(A16="",D16=0),"",F16/D16)
  • H16 markup: =IF(OR(A16="",C16=0),"",F16/C16)
  • I16 revenue: =IF(A16="","",D16*E16)
  • J16 gross profit: =IF(A16="","",F16*E16)

For the whole bean coffee 12 oz the profit per unit is 10.60, the margin is 66.3% and the markup is 196.3%. A markup can go far above 100%, but a margin never can.

Row 28 holds the totals. E28, I28 and J28 are plain SUMs. The overall margin in G28 needs care:

=IF(I28=0,"",J28/I28)

Do not average the twelve percentages. The cold brew bottle sells 1,350 units and the French press only 36, so a simple average would give the French press as much weight as the bottle. Dividing total profit by total revenue gives the true overall margin of 57.0%. The overall markup in H28 is =IF(I28-J28=0,"",J28/(I28-J28)), because revenue minus profit is the total cost. It comes to 132.7%.

Step 4: Flag products below the target margin

In K16 a nested IF compares each margin with the target:

=IF(A16="","",IF(G16<$B$13,"Below target","OK"))

Fill it down, then count the problems in K28 with =COUNTIF(K16:K27,"Below target"). The answer is 4. To make them easy to spot, select A16:K27, add a conditional formatting rule with the formula =$K16="Below target" and give it a light red fill with dark red bold text. The dollar sign locks the column so each row checks its own status.

The four products are the pour-over brewing kit (41.7%), the French press (31.7%), the holiday gift box (43.6%) and the monthly coffee subscription (42.2%). All four have a markup above 45% and still miss a 45% margin, which is the lesson of this whole sheet.

Step 5: See what a discount does to your margin

Pick a product in the drop down in B31. Two lookups pull its full price and cost from the list. In B32:

=INDEX(D16:D27,MATCH(B31,A16:A27,0))

In B33 use the same formula with C16:C27 as the first range. For the pour-over kit that returns 42.00 and 24.50. The table below it has one row per discount from 0% to 25%, and these formulas fill down:

  • B36 sale price: =$B$32*(1-A36)
  • C36 profit per unit: =B36-$B$33
  • D36 margin: =IF(B36=0,"",C36/B36)
  • E36 change in profit per unit: =C36/$C$36-1
  • F36 extra sales needed: =IF(C36<=0,"Loss on every sale",$C$36/C36-1)
Discount impact table in Excel showing margin and extra sales needed
Snapshot 3: the discount impact table for the pour-over brewing kit, from 0% to 25% off.

Read the 10% row. The sale price is 37.80, the margin falls from 41.7% to 35.2% and the profit per unit drops 24%. To earn the same total profit you need 31.6% more sales. At 25% off you need 150% more. That is why a big sale can leave you busier but not richer.

Switch the picker to the French press and the picture is worse. Its full price margin is only 31.7%, and at 25% off the profit per unit is 1.95, so you would need 371.8% more sales. Some products should simply never be discounted.

How to use the calculator on your own products

Type your products, costs, prices and monthly units in the yellow cells and replace the sample rows. Set your own target margin in B13. Raise it to 55% on the sample data and five products are flagged instead of four, because the ceramic mug turns red as well. Use the price box to test a new product before you launch it. If you want margins across a whole business with revenue, costs and net profit by month, open the free profit and loss template.

Common mistakes

  • Adding a percentage to cost and calling it margin. That is markup. Use the price box to get the real price.
  • Averaging margin percentages. Weight them by revenue, as the overall margin in G28 does.
  • Ignoring what a discount costs. Check the extra sales needed before you offer one.
  • Forgetting the empty-row test. Without the IF, blank rows show errors and break the totals.
  • Counting gross margin as profit. Rent, wages and fees still come out of it, so track those in a bookkeeping template.
Small Business Profit and Loss Template in Excel

Want more than the free file?

Small Business Profit and Loss Template in Excel

See revenue, costs and net profit for every month, with the margins of your whole business in one place.

Get the full version

Your next step: download the file, enter your five best-selling products and see which ones miss your target margin.

Frequently asked questions

How do you calculate profit margin in Excel?

Subtract the cost from the selling price to get the gross profit, then divide the profit by the selling price. If the price is in B7 and the cost is in B6, use =(B7-B6)/B7 and format the cell as a percentage.

What is the difference between margin and markup?

Margin divides the profit by the selling price. Markup divides the same profit by the cost. A product that costs 20.00 and sells for 30.00 has a 33.3% margin but a 50% markup.

How do you find the selling price for a target margin?

Divide the unit cost by one minus the target margin. For a cost of 12.40 and a 45% margin the price is 12.40 / (1 - 0.45) = 22.55.

How do you calculate the overall margin of many products?

Divide total gross profit by total revenue. Do not average the individual margin percentages, because high volume products should count for more than slow ones.

How much more do you need to sell after a discount?

Divide the profit per unit at full price by the profit per unit at the discounted price and subtract one. A 10% discount on a product with a 41.7% margin needs about 31.6% more sales to earn the same profit.

Is the profit margin calculator free?

Yes. The practice file and the finished solution file are free to download from this page. They open in Excel with no macros and no add-ins.

Free download

Profit Margin Calculator practice and solution files (.zip)

Working formulas, sample data and a How to use sheet. Opens in Excel, or import it into Google Sheets.

Download free (.xlsx)
Cash Flow Template in Excel

Want the finished version?

Cash Flow Template in Excel

Track monthly cash in and out with automatic net cash and closing balance.

View the pro template

Written by

Priyendra Kumar (PK)

Excel, Google Sheets and Power BI trainer

PK is the founder of PK: An Excel Expert and NextGenTemplates.com and a corporate trainer in Excel, VBA and Power BI. Since 2020 he and his team have built Excel and Google Sheets tutorials and templates for business users.

About The Margin Sheet · PK: An Excel Expert

Education only. Not financial, tax or investment advice.

The Margin Sheet

Finance in Excel, Google Sheets and Power BI, explained step by step, with a free template in every tutorial.