# How to calculate selling price from cost and a target margin in Excel

Divide the cost by 1 minus the margin: `=B2/(1-$F$1)`. A $30 item at a 40% margin sells for $50.

**Excel:** `=B2/(1-$F$1)` (Every current version)

**Google Sheets:** the same formula works.

## Example

Sample data (row 1 is the header):

| A | B | C | D | E | F |
| --- | --- | --- | --- | --- | --- |
| Product | Cost | Price |  | Target margin | 0.4 |
| Notebook | 30 |  |  |  |  |
| Backpack | 62.5 |  |  |  |  |
| Jacket | 140 |  |  |  |  |
| Water bottle | 8.4 |  |  |  |  |
| Boots | 310 |  |  |  |  |

Formula in C2, filled to C6: `=B2/(1-$F$1)`

Result: $50.00; $104.17; $233.33; $14.00; $516.67

## How it works

Margin is profit as a share of the price, so at a 40% margin the cost is the other 60% of the price. Dividing the cost by `1-$F$1` gives the price: 30 / 0.6 = 50, which leaves 20 of profit, 40% of 50.

## Other ways

- `=B2*(1+$F$1)`: Adds 40% to the cost, which is a 40% markup, not a 40% margin. (Prices are too low: the notebook sells for $42, a 28.6% margin.)

## Common mistakes

- Adding the margin percentage to the cost gives a lower margin than you aimed for.
- A margin of 100% or more is impossible (the formula divides by zero or goes negative): the cost can never be zero percent of the price.

## Questions

**How do I check the margin of a price?**

Divide the profit by the price: `=(C2-B2)/C2`.

**How do I round the price to end in .99?**

Round up to a whole number and subtract a cent: `=ROUNDUP(B2/(1-$F$1),0)-0.01`.

Every formula and result on this page was checked by running it in the Spreadsheet Practice formula engine on 2026-10-30.

Source: https://spreadsheetpractice.com/formulas/selling-price-from-cost-and-margin
