The Excel formula for margin is =(price − cost) / price, then format the result cell as a percentage. If your selling price sits in cell C2 and your cost in cell B2, type =(C2-B2)/C2 and press Enter. That returns margin as a share of the price — not markup over cost, which is a different number entirely.

Most spreadsheets get this wrong in the same place: they divide the profit by the cost instead of the price. That single swap turns a margin into a markup, and the two are never equal. This guide gives you the exact formula, the cell-by-cell setup, common errors to avoid, how to use a locked cell for a shared margin target, and the profit angle almost every other "margin in Excel" page skips.

The core Excel formula for margin

Margin measures profit as a percentage of revenue. So the numerator is your profit (price minus cost) and the denominator is the price you charge.

The Excel formula for margin is:

=(price - cost) / price

As confirmed by Exceljet and corroborated by Excel-Easy, the standard form is =(price-cost)/price. The result comes back as a decimal such as 0.60, which you then format as a percentage to read it as 60%.

Step by step in a spreadsheet

Say you sell a printed hoodie for $40 that costs you $16 to make and fulfill. Here is the exact build:

  1. Put the price in cell C2: 40.
  2. Put the cost in cell B2: 16.
  3. In cell D2, type the margin formula: =(C2-B2)/C2.
  4. Press Enter. Excel shows 0.6.
  5. Select D2, then press Ctrl+Shift+% (or click the % button on the Home tab) to format it as a percentage. It now reads 60%.

To calculate the dollar profit alongside the percentage, add one more cell. In E2, type =C2-B2, which returns $24. That $24 is your gross profit per unit, and 60% is that same profit expressed against the price.

If you have a whole product list, put the formula in the first row and drag the fill handle down. Lock nothing — the relative references C2 and B2 shift correctly row by row, so C3/B3, C4/B4, and so on all calculate on their own line.

Using a locked cell for a shared margin target

A common variation is storing the target margin once in a single cell — say B1 — and referencing it across every row. As discussed in the Microsoft Q&A community, this lets you adjust the margin in one place and watch every item's required price update automatically.

To do this, lock the row with a dollar sign: in your price column, write =B2/(1-$B$1). The $B$1 stays fixed when you drag the formula down; the B2 cost reference shifts row by row. Change the margin in B1 and every price recalculates instantly.

Common Excel margin formula errors to avoid

Three mistakes account for nearly every wrong margin result in a spreadsheet:

  • Dividing by cost instead of price. As MyExcelOnline confirms, markup divides by cost while margin divides by selling price — two very different denominators. (40-16)/16 returns 150% (markup); (40-16)/40 returns 60% (margin). The denominator is everything.
  • Forgetting parentheses. Excel reads left to right, so =C2-B2/C2 is not the same as =(C2-B2)/C2. Always wrap the subtraction in brackets first.
  • Not formatting as a percentage. As noted by Omni Calculator, you should right-click the final cell, select Format Cells, and choose Percentage — or simply press Ctrl+Shift+% — so 0.6 displays as 60% rather than looking like an error.

Back-calculating a selling price from a target margin

Once you know the margin formula, you can rearrange it to find the price you need to hit a target margin. If you know your cost and want a specific gross margin, the formula is:

=cost / (1 - target_margin)

With a cost of $16 and a target margin of 60%: =16 / (1 - 0.6) = 16 / 0.4 = $40. That is the minimum price to land exactly at 60% gross margin. In a spreadsheet with cost in B2 and target margin in E2, the price cell reads =B2/(1-E2). Change either input and the required price updates automatically.

This is especially useful for print-on-demand sellers pricing a new product: enter the Printify or Printful production cost, set your target margin, and the formula tells you the floor price before you even open your Shopify product editor. For a full breakdown of what those production costs actually look like, see our guide on Bella Canvas 3001 Printify pricing for POD sellers.

The Excel formula for profit margin: gross, operating, net

"Profit margin" is a family of ratios, not one number. They share a shape — some profit figure divided by revenue — but subtract different costs. The Excel formula for profit margin depends on which layer you mean.

  • Gross profit margin: =(Revenue - COGS) / Revenue. COGS is the direct cost of the goods themselves. This is the same calculation as the core margin formula above. As Excel-Easy illustrates, dividing gross profit by total revenue and clicking the percentage symbol on the Home tab gives you the GPM directly.
  • Operating profit margin: =(Revenue - COGS - Operating Expenses) / Revenue. As noted by Excel-Easy, operating expenses include rent, equipment, inventory costs, and marketing — everything beyond the raw product cost.
  • Net profit margin: =(Net Profit) / Revenue, where net profit is what remains after every cost, including interest and tax.

In a spreadsheet with revenue in C2, COGS in B2, and operating costs in F2, your operating margin cell would read =(C2-B2-F2)/C2. The three-step method is always the same: build the profit numerator, divide by revenue, format as a percentage.

The Excel formula for margin percentage vs markup

This is the trap. Margin and markup describe the same dollar gap, but against different denominators — and confusing them is a classic pricing error.

  • Margin is the gap over price: =(price - cost) / price.
  • Markup is the gap over cost: =(price - cost) / cost.

As MyExcelOnline puts it: markup is based on the cost price, whereas margin is based on the selling price. Using the hoodie again, price $40 and cost $16:

  • Margin: (40 - 16) / 40 = 0.6060% margin.
  • Markup: (40 - 16) / 16 = 1.50150% markup.

Same $24 gap, two very different percentages. A supplier who tells you they apply a "50% markup" is not giving you a 50% margin.

To convert between them in Excel:

  • Margin from markup: =markup / (1 + markup). With a markup of 1.5: 1.5 / 2.5 = 0.60.
  • Markup from margin: =margin / (1 - margin). With a margin of 0.6: 0.6 / 0.4 = 1.5.

If you price your catalog off a target margin, the second formula is the one you want: it tells you the markup multiplier to apply to each item's cost so every product lands at the same margin. For a deeper look at how Printify's base costs affect your realistic markup room, see our guide to what Printify costs.

A worked example: from margin to true per-order profit

Gross margin is where most sellers stop — and where the number stops being honest. A 60% gross margin on a $40 order sounds healthy, but it ignores everything else that leaves your bank account on that same sale.

Say you sell that $40 hoodie. Here is what actually comes out per order:

Line Amount
Revenue $40.00
− Product cost (COGS) −$16.00
= Gross profit (60% margin) $24.00
− Shipping −$5.00
− Payment processing fees −$1.60
− Pick and pack / fulfillment labor −$1.40
= Contribution margin before ads $16.00
− Ad spend allocated to the order −$10.00
= Profit after ads $6.00

The 60% gross margin quietly compresses once ads and variable costs are in. In Excel, contribution margin is =(C2 - B2 - shipping - fees - labor) and the post-ad figure subtracts one more term. The formula shape never changes; you just keep subtracting real cost lines.

This is the number that decides whether growth is safe. A campaign that looks strong on the ad platform can still lose money per order on a thin contribution margin. For context on how ad tracking accuracy affects this calculation, see our guide on setting up conversion tracking for Google Ads on Shopify — missing ValueTrack tokens can silently corrupt your per-channel cost numbers.

Building a multi-product margin tracker in Excel

For a catalog with more than a handful of SKUs, a single-row formula is not enough. Here is a minimal layout that scales cleanly:

Column Header Formula (row 2)
A Product name
B Cost (COGS)
C Selling price
D Gross profit $ =C2-B2
E Gross margin % =(C2-B2)/C2 → format as %
F Target price (at 60% margin) =B2/(1-0.6)

Drag rows 2 through however many SKUs you carry. Column F immediately flags every product priced below your margin floor. Sort by column E ascending to see your worst-margin items first — those are the ones most worth repricing or cutting.

If you fulfill through Printify or Printful, be aware that the production cost in column B should reflect the actual order cost, not the catalog list price. Provider prices shift with supplier changes; a static spreadsheet will silently go stale if you do not update it manually after every supplier or base-cost change. For a full look at what shipping adds to your landed cost, our guide on Printify free shipping and coupon codes breaks down how shipping costs eat into the margins your spreadsheet shows.

Margin and Printify POD pricing: what the spreadsheet misses

A margin tracker is only as accurate as its cost inputs, and for Printify sellers those inputs are trickier than they look. The catalog price you see before placing an order can differ from the itemized cost that appears on a completed order — especially once you factor in shipping, print provider selection, and any premium subscription discounts.

Two things that commonly distort a POD margin spreadsheet:

  • Catalog list price vs. actual order cost. If you seed column B from the Printify catalog rather than from real order invoices, you may be working with a figure that differs from what Printify charges at checkout. Always reconcile against completed orders.
  • Platform choice. Where you sell affects fees, and fees affect net margin. Our comparison of Shopify vs Printify covers how platform costs interact with your gross margin math. And if you're evaluating whether selling on Etsy makes sense alongside Shopify, see our Printify Etsy setup guide — Etsy's transaction and listing fees need their own column in your tracker.

The most reliable fix is to pull costs from completed orders rather than from catalog estimates. Our Printify Shopify app setup guide walks through the integration steps that get order-level cost data flowing correctly into your workflow.

Where a spreadsheet stops being enough

A margin formula in Excel is perfect for one product at rest. It breaks down when the inputs move — supplier prices change, shipping varies by order, payment fees float, and ad spend has to be split across hundreds of orders that each carry different real costs.

At that point you are maintaining a spreadsheet instead of running a store.

This is the gap PodVector closes. It connects your Shopify store with Meta Ads, Google Ads, Printify, and Printful data in a live warehouse, then computes the true per-order profit — the $6 line in the table above, not the $24 one — automatically across every order. Victor, the built-in AI employee, reads that live data, surfaces which products and campaigns are actually profitable, and can take Shopify-side actions with your approval: repricing your worst-margin SKUs to a target margin, bulk-updating prices across your store, or adjusting your free-shipping threshold. He reads your Meta and Google ad data to inform the recommendation but does not touch your ad accounts — those are read surfaces. Victor is not a dashboard you have to babysit; he analyzes and proposes, and you approve or reject each move before anything changes.

If you are just getting started with the Printify side of your store, our Printify getting started guide covers the foundational setup steps before margin optimization makes sense.

See your true per-order margin with PodVector

FAQs

What is the Excel formula for margin?

The Excel formula for margin is =(price - cost) / price, formatted as a percentage. With price in C2 and cost in B2, you type =(C2-B2)/C2. It expresses profit as a share of the selling price.

What is the Excel formula for profit margin?

For gross profit margin, use =(Revenue - COGS) / Revenue. For operating margin, subtract operating expenses too: =(Revenue - COGS - OpEx) / Revenue. Net margin divides net profit — what is left after all costs — by revenue. Each result is formatted as a percentage.

How do I calculate margin percentage in Excel?

Build the formula, then format the cell. Type =(C2-B2)/C2 to get a decimal like 0.6, select the cell, and press Ctrl+Shift+% to convert it to 60%. The Excel formula for margin percentage is the same formula plus percentage formatting — the formatting is what turns 0.6 into 60%.

How do I find the selling price from cost and a target margin?

Rearrange the margin formula: =cost / (1 - target_margin). With a cost of $16 and a target margin of 60%, that is =16/(1-0.6), which returns $40. In a spreadsheet, put cost in B2 and target margin in E2, then write =B2/(1-E2) in your price cell.

How do I lock a target margin cell for the whole sheet?

Store your target margin in a single cell — for example, B1 — and reference it with absolute notation: =$B$1. In your price column, the formula becomes =B2/(1-$B$1). The cost reference shifts row by row; the target margin stays locked. Change the value in B1 and every price in the column recalculates automatically.

Why is my Excel margin higher than expected?

You are almost certainly dividing by cost instead of price, which gives markup, not margin. (40-16)/16 is 150% markup; (40-16)/40 is 60% margin. Check that your denominator is the selling price.

Is margin the same as markup in Excel?

No. Margin divides the profit by the price; markup divides the same profit by the cost. A 60% margin equals a 150% markup on the identical $40 price and $16 cost. Always confirm which denominator a supplier or spreadsheet is using before comparing numbers.

Does gross margin tell me if an order is profitable?

Not on its own. Gross margin only subtracts product cost. Real per-order profit also nets out shipping, payment fees, fulfillment labor, and the ad spend it took to win the sale — which can turn a strong gross margin into a much thinner number. To judge whether a sale actually pays, calculate contribution margin after ads, not gross margin.

Why does my Excel margin formula show the wrong number?

The three most common causes: (1) you forgot parentheses — =C2-B2/C2 is wrong; =(C2-B2)/C2 is correct; (2) you are dividing by cost instead of price; (3) the cell is not formatted as a percentage, so 0.6 looks like an error instead of 60%. Fix the formula first, then apply percentage formatting.