TaskbyTask.Practical AI guides for work
Claude · Practical walkthrough

Ask Claude to make a spreadsheet, then check the formulas

A margin of 33.3% can look convincing and still divide by the wrong number. Define the calculation before asking Claude to build the workbook, then check what it actually built.

Task by Task12 min read + practice
A ceramic mechanical calculator has a lime input slider and clearly connected teal counting wheels.

What you'll make

a small .xlsx workbook with editable price and cost cells, a live margin formula you’ve read, and a quick test that it changes when the inputs do.

What you'll need

Claude with Code execution and file creation turned on (Settings › Capabilities; it’s on all plans, and on Team and Enterprise an owner can switch it off in Organization settings › Capabilities), Excel or another spreadsheet app, and about 15 minutes. Using ChatGPT instead? See create a downloadable spreadsheet with working formulas.

Example result.

Cell Shows Formula bar
B4 Difference £10.00 =B2-B3
B5 Margin 25.0% =IF(OR(B2="",B3=""),"Missing input",IF(B2=0,"Undefined",B4/B2))

1. Define the formula before you ask

Write down what the percentage means: what’s divided by what. “Margin” here is (selling price − item cost) ÷ selling price. Dividing the same difference by cost gives markup, a different number. Leave the choice to Claude and you may get either.

Decide the awkward cases too. A selling price of zero has no defined margin. A blank cost is missing, not zero. A cost above the price gives a negative margin, which is a valid result.

Why this works: a percentage has to mean something before you can check it.

What you should see: one written formula and a line for each awkward case.

2. Ask for live formulas in a new file

Create a downloadable .xlsx called item-margin-practice.xlsx with one
sheet. Put selling price (GBP) and item cost (GBP) in separate editable
input cells. Calculate difference as price minus cost, and margin as
that difference divided by selling price. Use formulas, not typed
results. If price is zero, show "Undefined"; if an input is blank or
not a number, show a warning and no result. Allow cost above price and
show the negative margin. Exclude tax and overheads. Then list the
cells and formulas you used.

Inputs: [price and cost]

[price and cost] is your two figures, such as “price £40, cost £30”.

Why this works: the stated formula fixes the denominator, and the awkward cases are decided before Claude has to guess.

What you should see: a short reply with the file to download from the conversation, and a list of cells and formulas.

3. Open the file, read the formula, change an input

Download and open the .xlsx. Select the margin cell and read the formula bar. If it shows a number such as 0.25 rather than a formula like =B4/B2, the result was typed in, not calculated.

Then check the formula divides by the price cell, not the cost cell. Change the cost and watch the margin move. Try a zero price and a blank cost too.

Why this works: the formula bar takes two seconds and tells you more than the chat’s description of the file.

What you should see: a formula in the margin cell that divides by the price, and a margin that changes when you change an input.

Check the result

  • The margin cell holds a formula, not a typed number.
  • It divides by selling price. With price £40 and cost £30, it shows 25%, not 33.3%.
  • Change cost to £20: margin becomes 50%.
  • A zero price shows “Undefined” and a blank cost shows a warning, not 0%.

The usual failure: the wrong denominator. The workbook divides by cost, so it shows markup (33.3%) under a “Margin” heading, and it looks entirely reasonable. Spot it by reading the formula bar: the bottom of the fraction should be the price cell.

The margin formula in the workbook divides by [observed cell or value].
Margin here is (selling price minus item cost) divided by selling price.
Correct the formula, keep the inputs editable, and recheck: the base
case, cost changed to £20, zero price, blank cost, and cost above price.
Save a corrected .xlsx and list the cells you changed.

[observed cell or value] is what the formula bar showed, such as “B3, the cost”.

Worked example: margin and markup

Fictional example. An item sells for £40 and costs £30. The difference is £10.

Margin (difference ÷ price):   £10 ÷ £40 = 25%
Markup (difference ÷ cost):    £10 ÷ £30 ≈ 33.3%
  • The failure. Claude’s first workbook showed Margin: 33.3%. The formula bar read =B4/B3, and B3 is the cost. Nothing on the sheet looked wrong; only the formula gave it away.
  • The repair. The repair prompt, with “B3, the cost”, changed the formula to divide by B2, the price. The corrected sheet is the example result.
  • The tests that proved it. Cost £20 gave 50%. Price £60 with cost £30 also gave 50%: two different inputs, the same expected answer. Cost £50 gave −25%, a valid negative margin. Price £0 showed “Undefined”, not a reassuring 0%.

Try it

Task by Task.Explore the example

One difference. Two different percentages.

Move the cost control to see why the denominator matters.

One difference. Two different percentages.Difference £10. Margin 25%: difference ÷ £40. Markup 33.33%: difference ÷ £30.022.444.8GBPSelling price40Cost30Difference10
Selling price£40Cost£30Difference£10

Difference £10. Margin 25%: difference ÷ £40. Markup 33.33%: difference ÷ £30.

Fictional item. Margin divides the difference by selling price; markup divides it by cost. Tax and overheads excluded. A zero denominator has no defined percentage.

Task by Task · Illustrative example

Task kit for this job: Download (ZIP) · Reusable instructions

Go deeper

Keep the definitions next to the inputs

For real work, agree the cost basis, tax treatment and what “margin” means in your reports with whoever owns the numbers. A mathematically correct ratio can still use the wrong kind of cost. Put a one-line definition beside the inputs so the next person reading the workbook doesn’t have to guess. For a model with several assumptions, see build a simple scenario model.

Check the first and last rows of a longer list

With a price list of twenty products, a formula filled down the column can drift: row 14 points at the wrong cost cell, or the last row is outside the summary range. Click the first, a middle and the last formula, and keep a manual answer for two of them. Spreadsheet formula tests covers the method in more depth.

Sources

Optional analytics

With your permission, Google Analytics uses cookies to measure visits and which guides people read. It stays off until you accept. Use Analytics choices in the footer to change your choice. Rejecting after accepting refreshes this page. Privacy details.