Calculate Profit Margin % in Excel: Formula and Steps

Formulas & functions · Updated November 18, 2026

To calculate profit margin in Excel, divide profit by revenue. With revenue in B2 and total costs in C2, enter =(B2-C2)/B2 in D2, then format D2 as a percentage. For example, revenue of $250 and costs of $175 produce a 30% margin. This guide shows how to set up the worksheet, choose the right costs, and resolve common errors.

What You’ll Need

  • Microsoft Excel for Microsoft 365 on Windows. The formula and percentage formatting steps also work in recent desktop versions of Excel.
  • A revenue or sales amount for each item or period you want to measure.
  • The matching costs for that same item or period. Decide which costs to include before calculating: cost of goods sold for gross margin, or a broader set of expenses for operating or net margin.
  • A blank column for the calculated margin, and optionally a calculator or hand calculation to verify the first result.

Step-by-Step

  1. Set up clear column headings. In a new worksheet, enter Revenue in A1, Costs in B1, and Profit Margin in C1. Put one item, product, or time period on each row. For example, row 2 could contain the revenue and costs for one product in a month. Using consistent headings and one record per row makes the formula easier to copy and the results easier to review.
  2. Enter the matching revenue and cost figures. Enter revenue in A2 and the costs you have chosen in B2. Keep both figures on the same basis: if revenue is for one month, costs should also cover that month; if revenue is for one product, use costs associated with that product. Use the same currency and make sure the amounts are numeric values rather than text. Include discounts, refunds, shipping, or other adjustments only if they belong in your chosen definition of revenue or costs.
  3. Choose the kind of profit margin you need. The margin calculation is profit divided by revenue, but profit depends on which costs you subtract. Gross profit margin typically compares revenue with cost of goods sold. Operating profit margin includes operating expenses as well. Net profit margin uses profit after all relevant expenses, which may include interest and taxes. For a simple product calculation, using revenue minus direct product costs gives a margin based on those direct costs, not necessarily the company’s net margin.
  4. Enter the margin formula. With revenue in A2 and the matching costs in B2, click C2 and enter =(A2-B2)/A2, then press Enter. The calculation first subtracts costs from revenue to find profit, then divides that profit by revenue. Excel may show a decimal such as 0.3 at first; that is the correct underlying result for a 30% margin. Parentheses make sure Excel subtracts the costs before dividing.
  5. Check the arithmetic with a simple example. If A2 contains 250 and B2 contains 175, profit is 250 minus 175, or 75. Dividing 75 by 250 gives 0.3, so the margin is 30%. If costs equal revenue, the result is 0%. If costs are greater than revenue, the result is negative, which indicates a loss for the selected scope. These outcomes help confirm that the formula is using the intended cells and not reversing the calculation.
  6. Format the result as a percentage. Select C2, then choose Home > Number > Percent Style (%). Excel displays 0.3 as 30%. To adjust the displayed precision, use Increase Decimal or Decrease Decimal in the Number group, or right-click the selected cell and choose Format Cells. In the Format Cells dialog, select Percentage and choose the number of decimal places. Formatting changes how the value is displayed, not the underlying calculation.
  7. Copy the formula down for other rows. Select C2 and use the fill handle, the small square at the lower-right corner of the selected cell, to drag the formula down through the rows that contain data. You can also copy C2, select the target cells in column C, and paste. Excel adjusts the relative references for each row: the next row calculates using A3 and B3, then A4 and B4, and so on. Check a copied row to confirm its formula points to that row’s revenue and costs.
  8. Label and review the results. Keep a clear heading such as Margin or Gross Margin % above the results, and use a consistent number of decimal places. Review a few rows manually, especially the first, last, and any unusually high or negative results. If you report a total for multiple products, calculate the overall margin from total profit divided by total revenue; do not simply average individual percentages unless an unweighted average is specifically what you intend to report.

Common Mistakes

  • Dividing by costs instead of revenue. Profit margin uses revenue as the denominator. Dividing profit by costs calculates markup, a different measure. For example, $75 profit on $250 revenue is a 30% margin, while $75 divided by $175 costs is about 42.9% markup.
  • Reversing the subtraction. Subtract costs from revenue, not revenue from costs. Reversing the order can make a profitable item appear to have a loss.
  • Mixing margin definitions. A margin based on direct product costs is not automatically operating or net margin. Identify the costs included in the calculation and label the result accordingly.
  • Adding a percent sign without percentage formatting. Typing a percent symbol as text or multiplying the formula by 100 and then applying percentage formatting can produce misleading or oversized results. Keep the formula as a decimal ratio and apply Excel’s Percentage format once.
  • Averaging percentages without weighting. A small sale and a large sale should not necessarily contribute equally to a combined margin. For an overall result, divide combined profit by combined revenue so larger sales carry their appropriate weight.
  • Including inconsistent or incomplete figures. Comparing monthly revenue with annual costs, or omitting costs that belong to the chosen margin definition, makes the answer unreliable even when the formula itself is correct.

Tips

  • Format revenue and costs as currency, and format the margin column as Percentage. Clear formatting helps distinguish dollar amounts from ratios.
  • Keep the source amounts and the formula in separate columns. That makes it easier to audit the calculation and change costs without overwriting a result.
  • Use a short note in the worksheet or a more specific heading, such as Gross Margin %, to record which costs are included. This is useful when the sheet is shared or updated later.
  • Choose decimal places that suit the purpose. A whole percentage is easy to scan in a summary, while one or two decimal places can help with closer comparisons. Avoid suggesting more precision than the source data supports.
  • For a combined margin across multiple rows, add up the relevant profits and revenues first, then divide total profit by total revenue. This gives a revenue-weighted result rather than treating every row as equal.
  • Save the workbook after checking the formulas, and preserve a copy of the original data if you are changing how costs or revenue are classified.

Troubleshooting

  • The result shows as 0.3 instead of 30%. The formula may be correct. Select the result cell and choose Home > Number > Percent Style (%). If it still looks wrong, check that you did not multiply the formula by 100 as well as applying percentage formatting.
  • Excel displays #DIV/0!. The revenue cell used as the denominator is blank or zero. Check that the right revenue value is in the referenced cell. A margin cannot be calculated when revenue is zero, so do not treat an error or an arbitrary zero as a meaningful margin.
  • The result is negative or unexpectedly large. Confirm that revenue and costs are in the correct columns, the subtraction is revenue minus costs, and the formula divides by revenue. Check whether the cost figures exceed revenue or whether a value was entered in the wrong row.
  • The formula appears as text instead of calculating. Make sure it begins with an equals sign and that the cell is not formatted as Text. Change the cell format to General, then edit the cell and press Enter to recalculate. Also check for an apostrophe before the equals sign, which forces Excel to treat the entry as text.
  • Copied rows all show the same answer. Click a result cell below the first row and inspect the formula references. If the formula was pasted as a fixed value, copy the original formula again; if references were deliberately locked with dollar signs, remove those locks so the row references adjust as you fill down.
  • The combined result does not match the average of row margins. That can be expected because row margins may represent different revenue amounts. Calculate combined profit divided by combined revenue for an overall, revenue-weighted margin, and use a simple average only when you deliberately want each row to count equally.

Frequently Asked Questions

What is the formula for profit margin in Excel?

Profit margin is profit divided by revenue, where profit is revenue minus the costs included in your calculation. With revenue in A2 and costs in B2, enter =(A2-B2)/A2, then format the result as a percentage.

Is profit margin the same as markup?

No. Margin divides profit by revenue, while markup divides profit by cost. Both can describe a price or sale, but they answer different questions and usually produce different percentages.

Can profit margin be more than 100%?

For the usual calculation with nonnegative costs, profit margin cannot exceed 100%, because profit cannot be greater than revenue. A result over 100% often signals that the wrong denominator or cell references were used, or that the figures need review.

Why is my profit margin negative?

A negative margin means the costs included in the calculation are greater than revenue. Check the inputs and confirm that the costs reflect the margin definition you intend to measure.

How do I calculate an overall margin for several products?

Calculate total profit across the selected products and divide it by their total revenue. This is generally more meaningful than taking the simple average of product percentages when sales amounts differ.

Is a 30% profit margin good?

Whether a margin is good depends on the business, industry, time period, and costs included. The example in this guide is illustrative, not financial, tax, or accounting advice. For reporting or business decisions, confirm the definitions and figures with a qualified accountant or other appropriate professional.

Related

Try it: the Formula Explainer: paste any formula and see each function and reference in plain English.

More in Formulas & functions

Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources

Spotted an error in this guide? Let us know.