Blog · Finance metrics and formulas
Gross profit margin is revenue minus cost of goods sold, divided by revenue. This page gives the formula, what US GAAP and the IRS put into cost of goods sold, a worked example on three product lines with the Excel formulas, the weighted-average identity that proves the total, and the three things that move the margin: price, cost and mix.
Gross profit margin is gross profit divided by revenue, where gross profit is revenue minus the cost of goods sold. It is the share of each sales dollar left after paying for what was sold, before any selling, administrative or financing cost. Revenue of $2,400,000 against cost of goods sold of $1,560,000 leaves $840,000 of gross profit, a 35% gross profit margin.
Gross profit = Revenue − Cost of goods sold
Gross profit margin = Gross profit / Revenue
Gross profit is the amount, in dollars. Gross margin, gross profit margin and gross profit percentage are the same ratio, shown as a percentage. The short definition is in the glossary under gross margin, and the profit margin calculator returns it, with operating and net margin, from four P&L lines.
The denominator is revenue, never cost. Gross profit divided by cost of goods sold is markup, a different number: on the figures above it is 840,000 / 1,560,000 = 53.8%.
Cost of goods sold is the cost of the inventory or services that were sold in the period. For a company that buys and resells, that is the purchase price less discounts, plus the freight and other charges to bring the goods in: the IRS defines the cost of purchased merchandise as "the invoice price minus appropriate discounts plus transportation or other charges incurred in acquiring the goods." For a manufacturer it adds direct labor and production overhead, all the direct and indirect costs capitalized into inventory.
What usually stays out: sales salaries and commissions, marketing, finance and head-office costs, and in most ledgers outbound delivery to customers. Those sit in operating expenses, below gross profit.
Policies differ between companies, and some choices are allowed either way. The SEC's income statement rules, Regulation S-X Rule 5-03, let wholesale and retail merchandisers include occupancy and buying costs in cost of tangible goods sold. That is why the one rule that matters is consistency: the same costs in the same line every period.
The inventory method matters too. US GAAP allows LIFO (last in, first out), and in the IRS's words, "in times of inflation, when prices are rising, LIFO will produce a larger cost of goods sold." Two otherwise identical companies, one on LIFO and one on FIFO, report different gross margins when costs rise. IFRS allows only FIFO or weighted average cost (IAS 2), so LIFO is a US-only difference.
One row per product line, customer or month, with three columns:
| Column | Content |
|---|---|
| A | Product line (or customer, or month) |
| B | Net revenue: invoiced sales after discounts, rebates and credit memos |
| C | Cost of goods sold for the same rows and the same period |
Net revenue, not gross invoiced revenue. Regulation S-X defines net sales as "gross sales less discounts, returns and allowances", and credit notes and returns booked in a later month belong against the sales they reverse.
One distributor, one fiscal year. Gross profit in D2 is =B2-C2; margin in E2 is =(B2-C2)/B2, filled down to row 4.
| Product line | Revenue (USD) | COGS (USD) | Gross profit (USD) | Gross margin |
|---|---|---|---|---|
| A | 1,200,000 | 840,000 | 360,000 | 30.0% |
| B | 700,000 | 385,000 | 315,000 | 45.0% |
| C | 500,000 | 335,000 | 165,000 | 33.0% |
| Total | 2,400,000 | 1,560,000 | 840,000 | 35.0% |
The total row sums B, C and D, and the total margin in E5 divides the summed gross profit by the summed revenue:
=SUM(D2:D4)/SUM(B2:B4)
That returns 35.0%. Never use =AVERAGE(E2:E4) for the total.
The company margin is the average of the line margins weighted by each line's share of revenue. Line A is 1,200,000 / 2,400,000 = 50.0% of revenue, B is 29.2% and C is 20.8%:
| Product line | Revenue share | Gross margin | Share × margin |
|---|---|---|---|
| A | 50.0% | 30.0% | 15.000 |
| B | 29.2% | 45.0% | 13.125 |
| C | 20.8% | 33.0% | 6.875 |
| Total | 100.0% | 35.000 |
The weighted sum is 35.0%, the same figure as total gross profit over total revenue. In Excel the check is one cell, and it must equal E5:
=SUMPRODUCT(B2:B4,E2:E4)/SUM(B2:B4)
The simple average of the three margins is (30 + 45 + 33) / 3 = 36.0%, one point too high, because it gives the small, high-margin line B as much weight as line A, which is half the business.
Three things, and only three.
Price. A lower realized price on the same cost cuts margin one for one. Discounts, rebates and special pricing for large accounts are where it happens; price realization by customer measures it.
Cost. Supplier increases, freight, and on LIFO a rising cost layer all raise cost of goods sold before prices catch up.
Mix. The same line margins can produce a lower total. Move $200,000 of revenue from line B to line A, with every line keeping its own margin:
| Product line | Revenue (USD) | Gross margin | Gross profit (USD) |
|---|---|---|---|
| A | 1,400,000 | 30.0% | 420,000 |
| B | 500,000 | 45.0% | 225,000 |
| C | 500,000 | 33.0% | 165,000 |
| Total | 2,400,000 | 33.75% | 810,000 |
Gross profit falls by 90,000 on line B and rises by 60,000 on line A: 840,000 − 90,000 + 60,000 = 810,000. Revenue is unchanged, no price or cost moved, and the margin fell from 35.0% to 33.75%. A falling total margin with stable line margins is a mix story, and it is the first thing to rule out before blaming pricing.
It depends on the industry, because the industry decides what sits in cost of goods sold. Aswath Damodaran's margins by industry, using US company data as of January 2026, give these averages:
| Industry (US) | Gross margin |
|---|---|
| Food wholesalers | 15.4% |
| Auto parts | 15.8% |
| Food processing | 23.2% |
| Retail (distributors) | 30.6% |
| Electrical equipment | 31.8% |
| Machinery | 37.5% |
| Software (system and application) | 71.7% |
| Total market | 37.8% |
Use a peer figure to see whether you are in the right range, then stop comparing. Your own trend, month by month and line by line, says more: a two-point fall in your margin is a finding, a two-point gap to an industry average usually is not.
One company margin hides the spread underneath it: by product line, by customer and by month. Covirage computes gross margin per line, customer and month from an uploaded ledger with deterministic tools and checks that the lines sum to the company total; the external AI model explains the mix shift and never calculates it. See customer profitability, margin by account for the method, and gross margin vs contribution margin vs net margin for the next two levels down.
It depends heavily on the industry. In Aswath Damodaran's January 2026 data for US companies, food wholesalers average 15.4%, distributors 30.6%, machinery makers 37.5% and system and application software 71.7%. Compare with peers in the same industry and watch your own trend month by month.
Gross profit is the dollar amount: revenue minus cost of goods sold. Gross margin, or gross profit margin, is that amount divided by revenue, expressed as a percentage. Both come from the same two lines of the P&L.
Only the wages directly tied to producing or delivering what was sold, such as factory labor or billable staff in a services business. Sales, finance and corporate salaries sit below gross profit in operating expenses.
Put revenue in B2 and cost of goods sold in C2, then enter =(B2-C2)/B2 and format the cell as a percentage. For a total across rows, divide the summed gross profit by the summed revenue.