← All how-to recipes

How to calculate profit margin (and not confuse it with markup)

✓ Verified in LibreOffice 25.8.7.3 ✓ Verified in Google Sheets (2026-08-30)

Work out margin from cost and price — and keep margin and markup straight.

The formula

AppFormulaNotes
Excel (desktop)=(B2-A2)/B2A2=cost, B2=price. MARGIN divides by price; markup is =(B2-A2)/A2 (divides by cost).
Google Sheets=(B2-A2)/B2Identical.
LibreOffice Calc=(B2-A2)/B2Identical.

How it works

Margin is profit as a share of the PRICE: ($80−$60)/$80 = 25%. Markup is the same profit as a share of the COST: $20/$60 = 33.3%. Same sale, different numbers — mixing them up is how products get underpriced. Going the other way: to hit a target margin m, price = cost/(1−m); a 25% margin on $60 cost means 60/0.75 = $80. Format the result as a percentage.

Verified, not just documented

We ran =(B2-A2)/B2 in LibreOffice 25.8.7.3 (headless, with forced recalculation) and it returned 0.25 — exactly the expected result. We then ran the same formulas in Google Sheets, executed 2026-08-30: a formula-only workbook goes into Google Drive, which converts it to a Sheet and recalculates every formula with Google’s own engine, and comes back out as .xlsx carrying the values Google computed. It returned 0.25 for the worked example, the same value LibreOffice produced. Both engines’ numbers on this page are executed results. The Excel formula follows Microsoft’s official documented syntax — we do not run desktop Excel.