Gross Profit Calculator
Work out gross profit and gross margin from revenue and cost of goods sold, for a single product or a whole product line at once. Then copy the exact Excel and Google Sheets formulas so you can run the same numbers on your own data.
How do you calculate gross profit?
Gross profit is revenue minus the cost of goods sold: gross profit = revenue - COGS. Gross margin is that figure as a percentage of revenue: gross margin = gross profit / revenue. On $100,000 of revenue with $60,000 of COGS, gross profit is $40,000 and gross margin is 40%. Operating costs like rent, salaries and marketing are not part of gross profit.
Gross profit and gross margin calculator
| Product | Units sold | Price / unit ($) | Cost / unit ($) | Revenue | Gross profit | Margin |
|---|---|---|---|---|---|---|
| $20,000.00 | $8,000.00 | 40.0% | ||||
| $22,500.00 | $6,750.00 | 30.0% | ||||
| $18,000.00 | $7,200.00 | 40.0% | ||||
| $0.00 | $0.00 | |||||
| $0.00 | $0.00 | |||||
| Totals | $60,500.00 | $21,950.00 | 36.3% |
Working in totals rather than per unit? Put 1 in Units and enter your total revenue as the price and your total COGS as the cost. Leave rows blank if you only sell one product.
Your gross profit
Gross profit stops at cost of goods sold. Operating expenses like rent, salaries and marketing come out next, on the way to operating profit and net profit. General information only, not accounting advice.
Get the free gross profit spreadsheet
A working Excel and Google Sheets version of this calculator, built for a full product list rather than five rows. Per line gross profit and margin, a blended total, and the margin and markup columns already wired up. Enter your email and we will send it over.
No spam. Unsubscribe any time.
What is the formula for gross profit and gross margin?
Two numbers come out of the same inputs. The dollar figure is gross profit, the percentage is gross margin, and they answer different questions. Here are the four steps.
Step 1: total your revenue
Revenue is price times units sold, summed across everything you sell in the period. If you only track a total sales figure, that total is your revenue and you can skip straight to step three.
Revenue = price per unit x units sold
Step 2: total your cost of goods sold
Cost of goods sold, or COGS, is the direct cost of producing or buying what you sold: materials, the labour that makes the product, and freight in. It does not include rent, office salaries, software or marketing. That distinction is where most gross profit numbers go wrong, and it is covered in its own section below.
COGS = cost per unit x units sold
Step 3: subtract to get gross profit
Gross profit is what is left of revenue after the direct cost of the goods, and before any operating expense.
Gross profit = revenue - COGS
Step 4: divide to get gross margin
Gross margin restates that dollar figure as a share of revenue, so you can compare a $5 product with a $5,000 one. Multiply by 100 to read it as a percentage, or format the cell as a percentage and skip the multiplication.
Gross margin = gross profit / revenue
Markup = gross profit / COGS
Margin and markup use the same gross profit on top but a different number underneath, which is why a 40% margin is a 66.7% markup, not the same figure. The markup and margin calculator converts between the two if pricing is what you are after.
Worked example: a three product line
Take the three products loaded into the calculator above. Each has a different margin, so the blended figure is not the average of the three, it is weighted by how much revenue each one brings in.
| Product | Revenue | COGS | Gross profit | Gross margin |
|---|---|---|---|---|
| Product A, 500 at $40, cost $24 | $20,000.00 | $12,000.00 | $8,000.00 | 40.0% |
| Product B, 300 at $75, cost $52.50 | $22,500.00 | $15,750.00 | $6,750.00 | 30.0% |
| Product C, 120 at $150, cost $90 | $18,000.00 | $10,800.00 | $7,200.00 | 40.0% |
| Blended total | $60,500.00 | $38,550.00 | $21,950.00 | 36.3% |
Two of the three products run at a 40% margin, yet the blend lands at 36.3%, not 40%, because Product B sells the most units at the thinnest margin and drags the mix down. A simple average of 40, 30 and 40 would say 36.7%, which is close here but wrong in principle. Always divide total gross profit by total revenue, never average the percentages.
What counts as cost of goods sold, and what does not
Gross profit is only as honest as the COGS line under it, and what belongs in COGS depends on what kind of business you run. Put an operating expense in COGS and your gross margin looks worse than it is. Leave a real product cost out and it looks better than it is.
| Business type | Usually in COGS | Usually not in COGS |
|---|---|---|
| Retail or ecommerce | Wholesale cost of the item, inbound freight, import duty | Marketing, store rent, salaries, payment processing fees |
| Manufacturing | Raw materials, direct production labour, factory overhead | Office salaries, sales commissions, distribution |
| Services or agency | Direct labour delivering the work, subcontractors, project materials | Admin staff, rent, software not tied to delivery |
| Software or SaaS | Hosting, third party API costs, support staff | Sales, marketing, research and development |
The test is simple: if the cost rises and falls with the number of units you sell, it is usually COGS. If you would pay it whether you sold one unit or a thousand, it is an operating expense and belongs below the gross profit line. Microsoft explains the underlying percentage maths in its guide to calculating percentages in Excel.
Gross profit, operating profit and net profit are not the same
Gross profit is the first of three profit lines on an income statement, and it is the highest of the three because the fewest costs have been taken out. Reading the wrong line is a common way to think a business is healthier, or sicker, than it is.
| Line | What is subtracted to reach it | What it tells you |
|---|---|---|
| Gross profit | Revenue minus cost of goods sold only | Whether the product itself makes money before running the business |
| Operating profit | Gross profit minus operating expenses like rent, salaries and marketing | Whether the core operation makes money |
| Net profit | Operating profit minus interest and tax | What the owners actually keep |
This calculator stops at the first line on purpose. To carry the numbers all the way down, our profit and loss statement template lays out all three profit lines in order.
How do you calculate gross profit in Excel?
Put revenue in column B and COGS in column C, one product per row, and the whole model is two formulas plus a total.
Gross profit and margin on one row
Gross profit = B2-C2
Gross margin = (B2-C2)/B2
Markup = (B2-C2)/C2
Format the margin and markup cells as a percentage rather than multiplying by 100, so the underlying value stays a true ratio you can chart or sort.
Revenue from units, and the blended total
If you hold units in column D and price in column E, revenue becomes =D2*E2. The blended margin across every product is the total gross profit over the total revenue, never the average of the row percentages.
Revenue = D2*E2
Blended margin = SUM(GrossProfit)/SUM(Revenue)
or = (SUM(B2:B20)-SUM(C2:C20))/SUM(B2:B20)
Stopping the divide by zero error
A product row with no revenue yet will fill the margin column with #DIV/0!. Wrap it so blank rows stay clean: =IFERROR((B2-C2)/B2,"") returns an empty cell instead. For a refresher on locking and wrapping formulas, see our guide to the IF function.
How do you calculate gross margin in Google Sheets?
Every formula above works unchanged, because subtraction, SUM and IFERROR behave identically. The differences show up only when you apply a formula down a whole column at once.
| Task | Excel | Google Sheets |
|---|---|---|
| Gross profit on one row | =B2-C2 | Identical |
| Margin as a percentage | =(B2-C2)/B2, cell formatted as percent | Identical, Format, Number, Percent |
| Fill the whole column at once | Fill down, or a table column | =ARRAYFORMULA(IF(B2:B="","",(B2:B-C2:C)/B2:B)) |
| Blended margin across products | =(SUM(B2:B20)-SUM(C2:C20))/SUM(B2:B20) | Identical |
| Hide errors on blank rows | =IFERROR((B2-C2)/B2,"") | Identical |
The ARRAYFORMULA row is the one that catches people out. A single formula in the header row fills the entire column and updates itself as you add products, which is why a Google Sheets model rarely needs formulas copied down by hand.
Gross margin and markup are the same profit seen two ways
These two get swapped in the same sentence constantly, and the gap between them is real money. Both sit on the same gross profit. Margin divides it by revenue, markup divides it by cost, so markup is always the larger number.
| Gross margin | Equivalent markup | On a $24 cost, the price is |
|---|---|---|
| 20% | 25% | $30.00 |
| 30% | 42.9% | $34.29 |
| 40% | 66.7% | $40.00 |
| 50% | 100% | $48.00 |
Quote a job at a 40% markup when you meant a 40% margin and you have left 26.7 points of markup on the table. If pricing from a target margin is the job, the markup and margin calculator does that conversion directly.
Troubleshooting a gross profit spreadsheet
My gross margin is over 100% and that cannot be right
It cannot. Gross margin is gross profit over revenue, and gross profit can never exceed revenue, so the ceiling is 100%. A margin above 100% means the formula is dividing by cost instead of revenue, which gives markup. Check that the denominator is the revenue cell, not the COGS cell.
My blended margin does not match the average of my products
It should not. The blend is weighted by revenue, so a high volume, low margin product pulls it down more than a niche high margin one lifts it. Divide total gross profit by total revenue rather than averaging the percentage column.
My gross profit looks too low
Usually an operating expense has been dropped into COGS. Rent, office salaries, marketing and software subscriptions belong below the gross profit line, not in cost of goods sold. Move them out and the margin corrects itself.
My gross profit is negative
The product is selling below its direct cost. That is a real result, not a formula error, and it is worth catching early. In the calculator above any line where cost per unit exceeds price will show a negative gross profit and a negative margin.
The margin column shows #DIV/0!
A row with zero revenue. Wrap the calculation with =IFERROR((B2-C2)/B2,"") so an empty product row stays blank instead of throwing an error across the summary.
Track gross profit on every product, not five at a time
The Simple Sheets profit and loss and profitability templates carry revenue, COGS, per product margin and the blended total across your full catalogue, in both Excel and Google Sheets.
See the Profitability templateGross profit calculator FAQ
How do you calculate gross profit?
Subtract the cost of goods sold from revenue: gross profit equals revenue minus COGS. On $100,000 of revenue with $60,000 of COGS, gross profit is $40,000. Cost of goods sold is only the direct cost of what you sold, so operating expenses like rent, salaries and marketing are not part of the calculation.
What is the difference between gross profit and gross margin?
Gross profit is a dollar figure, gross margin is a percentage. Gross profit is revenue minus COGS. Gross margin is that gross profit divided by revenue, which restates it as a share of sales so you can compare products of very different sizes. A $40,000 gross profit on $100,000 of revenue is a 40% gross margin.
How do you calculate gross profit in Excel?
With revenue in B2 and COGS in C2, gross profit is =B2-C2 and gross margin is =(B2-C2)/B2 with the cell formatted as a percentage. For revenue from units, use =D2*E2. Wrap the margin in =IFERROR((B2-C2)/B2,"") so blank rows do not throw a divide by zero error.
How do you calculate a blended gross margin across products?
Divide total gross profit by total revenue, not the average of each product's margin. In a spreadsheet that is =(SUM(revenue)-SUM(COGS))/SUM(revenue). Averaging the percentage column ignores that products sell in different volumes, so a high volume, low margin line should weigh more heavily in the result.
What is a good gross profit margin?
It depends entirely on the industry. Grocery and retail often run 20 to 30%, manufacturing 25 to 35%, and software can exceed 80% because the cost of serving one more customer is tiny. There is no universal target, only your own trend over time and a comparison against businesses with the same cost structure.
Is gross profit the same as net profit?
No. Gross profit subtracts only the cost of goods sold. Net profit goes further and subtracts operating expenses, interest and tax as well, so it is always the smaller number. Gross profit tells you whether the product makes money, net profit tells you what the owners keep after running the whole business.
What is the difference between margin and markup?
Both are built on the same gross profit. Margin divides it by the selling price, markup divides it by the cost, so markup is always the larger percentage. A 40% gross margin is the same money as a 66.7% markup. Confusing the two when setting prices is a common and expensive mistake.
Does gross profit include labour?
Only direct labour, the labour that actually makes the product or delivers the service. A factory worker or a billable consultant belongs in cost of goods sold. Office, admin and sales salaries are operating expenses and sit below the gross profit line, so they reduce net profit but not gross profit.
More free tools and templates
Convert between margin and markup and price from a target.
Find the unit volume where revenue covers cost.
All three profit lines in order, Excel and Sheets.
Per product and per customer margin across the catalogue.
Every Simple Sheets finance spreadsheet in one place.
Calculators and cheat sheets, no cost.
Last updated: 12 September 2026. General information only, not accounting, tax or financial advice.