Gross profit is revenue minus the direct cost of what you sold. Gross margin is that profit divided by revenue. The free gross profit calculator below works both out for every product, adds the totals and flags any product that earns less than the margin you want. In the sample, 2,785 units bring in 55,548.00 of revenue and 21,648.00 of gross profit, a gross margin of 39.0%.
Free download
Gross Profit Calculator (.xlsx, also opens in Google Sheets)
Working formulas, sample data and a How to use sheet. Opens in Excel, or import it into Google Sheets.
Gross profit, gross margin and markup in one minute
Three numbers get mixed up all the time, so it helps to keep them apart. Gross profit is an amount of money. Gross margin and markup are percentages, and they use different bases.
- Gross profit = revenue minus cost of goods sold.
- Gross margin % = gross profit divided by revenue.
- Markup % = gross profit divided by cost.
Take a mug that costs 10.00 and sells for 16.00. The gross profit is 6.00. The margin is 6.00 divided by 16.00, which is 37.5%. The markup is 6.00 divided by 10.00, which is 60%. Same product, two percentages, and only one of them tells you how much of each sale you keep. If you want the full explanation, read the profit margin formula in Excel.
What is inside the free gross profit calculator
The workbook has a How to use sheet and one Gross Profit sheet. It has no macros and opens in Google Sheets. Three yellow cells at the top hold the business name, the period and your target gross margin. A Totals box and four cards show revenue, gross profit, gross margin and the number of products below target. The table below has room for 12 products, with a Total row at the bottom.
The sample is a made up coffee roaster called Harbor Coffee Roasters for Q1 2027. It sells eight products, from 250 g bags of beans to a gift box. The target margin is 40%.

Who this calculator is for
- Small shop owners who want to know which products pay the bills.
- Online sellers who set prices from the cost of goods and need a quick margin check.
- Freelancers who sell products next to their services and want one clear table.
This is educational content, not financial advice. The figures are made up, so replace them with your own.
How to build the gross profit calculator step by step
The product table starts in row 16. Column A is the product, B the units sold, C the price per unit and D the cost per unit. Those four columns are typed. Everything from column E onward is a formula. The target margin sits in B7.
Step 1: Revenue
Revenue is units times price. In E16:
=IF(OR(B16="",C16=""),"",B16*C16)
For Ethiopia Yirgacheffe 250 g, 640 units at 14.50 give 9,280.00. The IF keeps the row empty until you type both numbers, so blank rows do not show zeros.
Step 2: Cost of goods sold
Cost of goods sold is units times the cost per unit. In F16:
=IF(OR(B16="",D16=""),"",B16*D16)
That product costs 7.20 per bag, so the cost is 4,608.00. Use only direct costs here: the goods themselves, freight in and packaging. Rent, salaries and software are operating expenses and belong below gross profit, in your profit and loss statement.
Step 3: Gross profit
Gross profit is revenue minus cost. In G16:
=IF(E16="","",E16-F16)
The result is 4,672.00. A small data bar in the column makes the biggest earners easy to spot. The best product in the sample is Colombia Huila 250 g, with 5,330.00 of gross profit.
Step 4: Gross margin %
Gross margin divides gross profit by revenue. In H16:
=IF(OR(E16="",E16=0),"",G16/E16)
The Ethiopia bag keeps 50.3 cents of every dollar of sales. The IF also protects the formula from a divide by zero when revenue is empty.
Step 5: Markup %
Markup divides gross profit by cost. In I16:
=IF(OR(F16="",F16=0),"",G16/F16)
The same bag has a markup of 101.4%. It is more than 100% because the profit is bigger than the cost, yet the margin is only 50.3%. This is why quoting a markup as if it were a margin overstates your profit.
Step 6: The price you need for your target margin
This is the most useful column. If you know the cost and the margin you want, the price is the cost divided by one minus the margin. In J16:
=IF(D16="","",D16/(1-$B$7))
With a 40% target, the Pour-over Kit costs 31.50 and needs a price of 52.50. It sells for 42.00 today, so its margin is only 25.0%. Multiplying the cost by 1.4 would give the wrong answer, because 40% is a share of the price, not of the cost.
Step 7: Flag the weak products
Column K compares each margin with the target in B7:
=IF(H16="","",IF(H16<$B$7,"Below target","OK"))

Conditional formatting turns the flag red or green. Five of the eight products fall below 40%: the Espresso Blend 1 kg, Cold Brew 6-pack, Ceramic Mug, Pour-over Kit and Gift Box. The Gift Box is the weakest at 24.0%, and it would need a price of 69.67 instead of 55.00 to reach the target.
Step 8: Totals and the check cell
The Totals box sums the table. Gross profit in E7 is revenue minus cost, and the margin in E8 divides it by revenue:
=IF(E5=0,0,E7/E5)
The result is 39.0% for the whole business. Do not average the margins of the rows, because a big product should count for more than a small one. A check cell in E11 confirms that the profit column adds up to the same total:
=IF(ROUND(SUM(G16:G27)-E7,2)=0,"OK","Totals differ")

What the sample tells the owner
The business earns 39.0% overall, just under its 40% target. Look at where that comes from. The two coffee bags above 50% carry the business. The kit, the gift box, the mug and the cold brew pull the average down. The owner has three simple options: raise the price of the weak products, find a cheaper supplier, or stop selling the ones that cannot reach the target. The calculator lets you test a new price or cost in a few seconds, because every result updates as you type.
Run the same table every month or quarter. A margin that slips by two points is easy to miss in a sales total, and obvious in a column of flags. Record the period in B6 and save one copy per period so you can compare. If you keep your books in a spreadsheet, the bookkeeping template in Excel is a good place to find your real cost figures.
Common mistakes
- Mixing up margin and markup. A 50% markup is a 33.3% margin, not 50%.
- Leaving out freight and packaging. If it is a direct cost of the product, it belongs in cost of goods sold.
- Putting overheads in the cost. Rent and salaries make net profit lower, not gross profit.
- Averaging row margins. Use total gross profit divided by total revenue.
- Using an old unit cost. Update the cost column whenever your supplier changes a price.
Adapt the calculator to your own business
Replace the sample products with yours, type your own target margin and watch the flags change. If you sell services, use the direct labor cost of the job as the cost. If you need more than 12 products, insert rows above the Total row and extend the SUM ranges.
Want more than the free file?
Retail Profit Margin KPI Dashboard in Excel
A retail dashboard for revenue, gross profit and profit margin by product, category and period, with targets and trends in one Excel file.
Your next step: download the file, type your five best selling products with their real costs, and see which ones meet your target margin.
Frequently asked questions
How do you calculate gross profit?
Gross profit is revenue minus cost of goods sold. In Excel, with revenue in E16 and cost in F16, use =E16-F16. Cost of goods sold should include only the direct costs of what you sold, such as the goods, freight in and packaging.
What is the gross margin formula?
Gross margin is gross profit divided by revenue, shown as a percentage. In Excel use =G16/E16 and format the cell as a percentage. A product that sells for 16.00 with a cost of 10.00 has a gross margin of 37.5%.
What is the difference between gross margin and markup?
Gross margin divides profit by revenue, and markup divides profit by cost. The same product can have a 37.5% margin and a 60% markup. Margin is always below 100%, while markup can be higher.
How do I find the price for a target gross margin?
Divide the cost by one minus the margin you want. For a cost of 31.50 and a 40% target, use =31.5/(1-0.4), which gives 52.50. Multiplying the cost by 1.4 gives the wrong price.
Does this gross profit calculator work in Google Sheets?
Yes. Upload the file to Google Drive and open it with Google Sheets. The IF formulas, the percentage formats and the conditional formatting all work there.
Free download
Gross Profit Calculator (.xlsx, also opens in Google Sheets)
Working formulas, sample data and a How to use sheet. Opens in Excel, or import it into Google Sheets.

Want the finished version?
Monthly Budget Planner Template in Excel
Plan income and spending and compare budget against actual every month.
View the pro templateEducation only. Not financial, tax or investment advice.
