=(Price-Cost)/Price, so with the price in B2 and the cost in C2 you type =(B2-C2)/B2 and format the cell as a percentage. For a print-on-demand store, put every cost in the "Cost" part: supplier base cost, shipping, payment fees and ad spend per order. That gives your true margin, not just the gross one.
Most guides stop at a two-row toy sheet. This one builds a sheet you can use on a real store with many products.
You will get the basic formula, the three margin types, target pricing, markup math, and a version that runs across hundreds of variants without breaking.
What is the Excel formula for profit margin?
The profit margin formula in Excel is =(B2-C2)/B2, where B2 is the selling price and C2 is the cost. Margin is the share of the price you keep after costs. It is always measured against the price, not the cost.
Set up your sheet like this:
- Column A: product name (say, "Cat Mom Tee – Black – M")
- Column B: selling price
- Column C: cost
- Column D: margin, with
=(B2-C2)/B2
Say a tee sells for $31 and your supplier charges $13 to print and ship it out. The math is ($31 − $13) ÷ $31 = 0.581. Format it as a percentage and Excel shows 58.1%.
How do you format a decimal as a percentage in Excel?
Select the margin cells and press Ctrl+Shift+%, or click Percent Style on the Home tab, as Microsoft's Excel guide explains. Do not multiply by 100 first. Microsoft notes that if a cell already holds 10, the Percentage format shows it as 1000.00%, so keep the formula as a decimal and let the format do the work.
If you want a plain number like 58.1 instead, use =(B2-C2)/B2*100 and leave the cell as a normal number. Just pick one style and use it everywhere.
What is the difference between margin and markup?
Margin is profit divided by the price; markup is profit divided by the cost. The same $18 profit on a $13 tee sold for $31 is a 58.1% margin but a 138.5% markup. Mixing the two up is the most common pricing mistake new sellers make.
In Excel:
- Margin:
=(B2-C2)/B2 - Markup:
=(B2-C2)/C2
Suppliers and sellers often talk in markup ("double your cost"). Your profit numbers are in margin. Our guide to markup vs margin formulas goes deeper on when to use each.
How do you convert markup to margin (and back)?
Use these two formulas, with the rate stored as a decimal in E2:
- Markup to margin:
=E2/(1+E2) - Margin to markup:
=E2/(1-E2)
So a 150% markup is 1.5 ÷ 2.5 = 60% margin. A 60% margin is 0.6 ÷ 0.4 = 150% markup.
How do you calculate gross, operating and net margin in Excel?
You use the same shape each time and change which costs you subtract. The ExcelDemy margin reference gives the generic versions. Here is what each one means for a print-on-demand store.
Gross margin. This subtracts only your cost of goods sold (COGS). COGS is what the product itself costs you. For print-on-demand, that is the supplier's base cost: the blank, the printing and their handling fee.
=(B2-C2)/B2
Operating margin. This also subtracts running costs like apps, your Shopify plan and design tools. If those sit in E2:
=(B2-C2-E2)/B2
Net margin. This is what is left after every cost, including taxes. If net profit sits in F2:
=F2/B2
Gross margin tells you if a product is worth making. Net margin tells you if the business made money. The step between them, contribution margin, is the one most store owners actually need. Read contribution margin vs gross margin for the full split.
How do you add shipping, fees and ad spend to a margin formula?
Add each cost as its own column and subtract them all from the price. This is your contribution margin. That is the profit left on each order after every cost that grows with sales.
Here is the layout for a POD sheet:
| Column | What goes in it | Example |
|---|---|---|
| B | Selling price | $31.00 |
| C | Supplier base cost (Printify, Printful or Gelato) | $13.00 |
| D | Shipping you pay that the buyer does not | $4.50 |
| E | Payment and platform fees per order | $1.20 |
| F | Ad spend per order | $8.24 |
| G | Contribution margin | formula below |
These are example numbers for a made-up store, not market data. Your own fees depend on your plan and payment provider.
The formula in G2:
=(B2-C2-D2-E2-F2)/B2
A worked example: one tee, three margins
Say your store does 340 orders a month at a $31 average order. You spend $2,800 a month on Meta ads. Ad spend per order is $2,800 ÷ 340 = $8.24.
Now walk the tee down:
- Gross margin: ($31 − $13) ÷ $31 = 58.1%
- After shipping and fees: ($31 − $13 − $4.50 − $1.20) ÷ $31 = $12.30 ÷ $31 = 39.7%
- After ads: ($12.30 − $8.24) ÷ $31 = $4.06 ÷ $31 = 13.1%
A tee that looks like a 58% winner keeps $4.06 per order. That is the number to price from. If your supplier cost looks oddly low, check why your COGS might be low before you trust the gross figure.
What about Etsy or TikTok Shop fees?
Give each sales channel its own fee column, or its own row per listing. Marketplace fees are often larger than a store's payment fee. If you sell the same design on Shopify and Etsy, the margins will differ, so do not copy one fee number across both.
How do you find the selling price for a target margin?
Divide the cost by one minus the target margin: =C2/(1-H2), with the target margin as a decimal in H2. This is the formula to use when you set prices for a new design.
Say your full cost per order is $13 + $4.50 + $1.20 = $18.70 before ads. You want to keep 40% before ads. The price is $18.70 ÷ (1 − 0.40) = $31.17. Round to $31 or $32 based on how your other products are priced.
Do not do this with markup by mistake. Adding 40% to $18.70 gives $26.18, which is only a 28.6% margin ($7.48 ÷ $26.18).
How do you scale the margin formula across hundreds of SKUs?
Turn your data into an Excel Table and look up costs instead of typing them. A SKU is one exact version of a product, like a black medium tee. A store with 40 designs in 6 sizes and 4 colours already has 960 of them.
Three steps make the sheet hold up:
- Make it a Table. Click inside your data and press Ctrl+T. New rows copy the formula down on their own.
- Keep costs on a second tab. List each SKU and its supplier cost on a "Costs" tab. Pull it in with
=XLOOKUP(A2,Costs!A:A,Costs!B:B,0). When a supplier changes a price, you fix one cell. - Get a weighted average. A plain average treats a SKU that sold once the same as one that sold 300 times. Use
=SUMPRODUCT(Sales,Margin)/SUM(Sales)where Sales is units sold.
How do you find the average, lowest and highest margin?
Use these on your margin column (say G2:G500):
- Average:
=AVERAGE(G2:G500) - Lowest:
=MIN(G2:G500) - Highest:
=MAX(G2:G500)
Add conditional formatting to turn any margin under your floor red. Home tab, Conditional Formatting, Highlight Cells Rules, Less Than, then type 0.15 for 15%.
How do you pull Shopify order data into the formula?
Export your orders as a CSV from the Shopify admin, then match its columns to your formula inputs. The order export has columns such as Lineitem name, Lineitem quantity and Lineitem price. Those map to your product, units and selling price.
The export does not include your supplier cost. So you add that with the XLOOKUP from the Costs tab, matched on the product or SKU. Your ad spend comes from Meta or Google Ads, divided by the orders in the same date range.
Keep refunds in mind too. A refunded order still cost you the print, so count it as a cost, not as a missing sale.
What are the most common mistakes in margin formulas?
Most broken margin sheets fail in one of these ways:
- Dividing by cost instead of price. That gives you markup, not margin.
- Forgetting the brackets.
=B2-C2/B2divides first and gives a wrong answer. Always write=(B2-C2)/B2. - Divide-by-zero errors. A free sample or blank row shows #DIV/0!. Wrap it:
=IFERROR((B2-C2)/B2,0). - Mixing tax into price. Use the price before sales tax, or your margin looks bigger than it is.
- Rounding too early. Round only in the display. If you must round in the formula, use
=ROUND((B2-C2)/B2,3)at the very end. - Stale costs. Suppliers change prices. A sheet built in spring can be wrong by autumn.
Is a spreadsheet the best way to track POD margins?
A spreadsheet is a fine place to start, but it only shows a snapshot. Costs, fees, refunds and ad spend change every day. Keeping a sheet current by hand is a weekly job on its own.
PodVector AI is the print on demand AI. Victor, its AI employee, runs the work of the business: designs, listings, orders, customer service, ads, email and the numbers. On the money side, Victor knows the real cost and profit of every order: sales minus supplier cost, fees, shipping, refunds and ad spend.
Victor reprices the thin-margin SKUs. He runs a monthly supplier cost review on his own and writes a short report after each run. You can try Victor free and ask him which products lost money last month. For every other store number, start with our guide to ecommerce metrics and how to calculate them.
FAQs
What is the simplest Excel formula for margin?
Type =(B2-C2)/B2, with the price in B2 and the cost in C2. Then press Ctrl+Shift+% to show it as a percentage. That is your gross margin.
How do I calculate margin after ad spend in Excel?
Divide your monthly ad spend by your monthly orders to get ad cost per order. Put it in its own column and subtract it with the other costs: =(B2-C2-D2-E2-F2)/B2. That is your contribution margin after ads.
What formula gives me a price for a 40% margin?
Use =C2/(1-0.4), where C2 is your full cost. A $18.70 cost gives a $31.17 price. Do not just add 40% to the cost, because that is markup.
How do I stop #DIV/0! errors in my margin column?
Wrap the formula in IFERROR: =IFERROR((B2-C2)/B2,0). Blank rows and free orders then show 0 instead of an error. Your averages and totals keep working.
Should I use average margin or weighted margin?
Use weighted margin for the whole store. =SUMPRODUCT(Sales,Margin)/SUM(Sales) gives more weight to the products that sell most. A plain average can make a store look healthier than it is.