Excel · Foundations · 7 min read

How Excel calculates

A spreadsheet is a grid of cells that each hold a value or a formula. Formulas point at other cells, copying shifts those pointers, and every change ripples through a chain of dependants.

The idea

A spreadsheet is a grid. Every box in it is a cell, named by its column letter and row number: B2 is column B, row 2. A cell holds one of two things, and the whole tool follows from the difference.

A value is something you typed: a number, some text, a date. It sits there and means what it says. A formula starts with = and is a small instruction: "work this out from other cells". The cell stores the instruction and displays the answer.

Figure 1

What a cell holds and what a cell shows

Sheet: what you typed
A_product_idB_quantityC_unit_priceD_line_total
121931.99=B2*C2
154311.99=B3*C3
Sheet: what you see
A_product_idB_quantityC_unit_priceD_line_total
121931.99287.91
154311.9935.97

Step 1 of 4 Columns A to D, rows 2 and 3 of the order-line sheet for order 1001. The first three cells of each row are plain values: you typed them and they stay as they are.

  1. Columns A to D, rows 2 and 3 of the order-line sheet for order 1001. The first three cells of each row are plain values: you typed them and they stay as they are.
  2. D2 holds a formula, not a number. Its text is =B2*C2: "take the cell two columns to my left, multiply by the cell one column to my left".
  3. Excel evaluates the formula and displays its result, 287.91. The cell still stores the formula; the number on screen is only what it currently produces.
  4. D3 holds the same kind of formula pointing at row 3, so it shows 35.97. Two cells, two different results, one idea.

That split is what makes a spreadsheet more than a table on paper. If C2 changes from 31.99 to 34.99, D2 is not stale: it is the current answer to a question you wrote once. The skill of Excel is writing the question so that it keeps being right.

Why it exists

Before spreadsheets, an analyst with a calculator wrote down 287.91, added 35.97 by hand, and wrote down 323.88. Change one quantity and you started over. Every number on the page was an answer to a question nobody had saved.

Excel saves the question. Harbor & Pine's order 1001 has two lines; the order total is not a number somebody pasted, it is =SUM(D2:D3). A manager can change a quantity, a price or a discount and the total follows, which is why the same workbook can be reused for next month's data or a "what if" about a price rise. It is also why a typed number sitting in the middle of a column of formulas is dangerous: it will never update and nobody will notice.

How it works under the hood

References are pointers

B2*C2 does not contain the numbers, it contains addresses. Excel looks at those addresses when it calculates. A range such as D2:D3 means every cell in the rectangle between the two corners, and functions like SUM and AVERAGE accept ranges as inputs.

Copying keeps the relationship

Here is the part that confuses most beginners. When you copy a formula, or drag the fill handle down a column, Excel does not copy the text. It copies the relationship: "two cells to my left" stays "two cells to my left", wherever the formula lands. That is why one formula written in D2 and filled down gives a correct formula in every row. A reference like B2 is relative: it moves with the copy.

Sometimes a pointer must not move. A single tax rate in E1 should be read by every row. Putting $ in front of the column letter, the row number or both locks that part: $E$1 is absolute, $E1 locks only the column and E$1 only the row. Pressing F4 while the cursor is inside a reference cycles through the four forms.

Figure 2

Copying a formula down a column: what moves and what stays

kitchen
rowunit_pricelocked_formula
413.99=B4*(1+$E$1)
538.99=B5*(1+$E$1)
6289.00=B6*(1+$E$1)
Without the dollar signs
rowformulapoints_atresult
4=B4*(1+E1)E1 = 0.082515.14
5=B5*(1+E2)E2 = empty38.99
6=B6*(1+E3)E3 = empty289.00

Step 1 of 4 Three Harbor & Pine kitchen prices (products 141, 142, 143). The sales tax rate, 8.25%, sits in one cell, E1. Every row needs unit_price * (1 + rate).

  1. Three Harbor & Pine kitchen prices (products 141, 142, 143). The sales tax rate, 8.25%, sits in one cell, E1. Every row needs unit_price * (1 + rate).
  2. With $E$1 the pointer is locked. Fill the formula down and the price reference moves (B4, B5, B6) while the rate reference stays on E1.
  3. Write E1 without dollar signs and the pointer is relative: it slides down with the formula. Row 5 looks at E2, which is empty.
  4. An empty cell counts as zero, so rows 5 and 6 get no tax at all: 38.99 and 289.00. Excel shows no error, which is why this bug is so easy to ship.

The dependency chain

Excel keeps a map of who reads whom. When you edit a cell, it finds every cell that reads it, recalculates those, then every cell that reads those, and so on, in the right order. It does not recalculate the whole workbook, so a sheet with thousands of formulas still updates instantly.

Figure 3

Change one cell and Excel recalculates only what depends on it

  1. B2 = 9 → 10 you edit a value
  2. D2 = B2*C2 line total changes
  3. D4 = SUM(D2:D3) order total changes
  4. F1 = IF(D4>=300, ...) anything that reads the total

Step 1 of 4 Order 1001 has two lines: 9 × 31.99 and 3 × 11.99. You change the quantity in B2 from 9 to 10.

  1. Order 1001 has two lines: 9 × 31.99 and 3 × 11.99. You change the quantity in B2 from 9 to 10.
  2. Excel knows that D2 reads B2, so D2 is recalculated first: 10 × 31.99 = 319.90.
  3. D4 reads D2, so it is next: 319.90 + 35.97 = 355.87. Cells that read D4 follow, in order. Cells that depend on nothing you changed are not touched.
  4. The chain ends when nothing else points at the last cell. You wrote no "refresh" step; the dependencies are the refresh.

This also explains two errors. A circular reference is a formula that eventually reads itself, so there is no right order and Excel warns you. A formula pasted as values has lost its pointers: it is now an ordinary typed number, and it will stay wrong when the source changes.

Ranges and Tables

A plain range is just a rectangle of cells. Nothing says that A1:D400 is "the orders": if a new row arrives in row 401, every formula still points at the old rectangle. An Excel Table (Insert → Table, or Ctrl+T) is a range that knows it is a table. It has a name, headers, and it grows when a row is added, and formulas can point at columns by name instead of by address. You meet Tables properly in the last chapters of this track; for now the rule is that a range is a rectangle you describe, a Table is a rectangle Excel keeps track of.

Formatting is not content

One more thing sits between a stored value and what you see: the number format. A date is stored as a number and displayed as a date; 0.0825 can be shown as 8.25%; 31.99 can be shown as 32. Changing the format changes the display, never the stored value, and a column that looks like numbers may hold text that SUM will ignore. When a result looks odd, check what is stored before you suspect the formula.

Common misconceptions

"The number in the cell is the number the cell holds"

What you see is the result of the formula, not the content. Click the cell and look at the formula bar: it shows what is actually stored. If a total looks right but won't change when the data does, it was probably typed or pasted as a value.

"Copy and paste copies the formula text"

It copies the relationship, so relative references shift. That is a feature (one formula fills a thousand rows) until a reference that should have stayed put slides away. When a filled-down column goes wrong, click the last row and check where its pointers ended up.

"A blank cell is an error"

A blank cell counts as zero in arithmetic and is skipped by SUM and AVERAGE. Pointing at the wrong cell therefore rarely produces an error; it produces a plausible wrong number. Always spot-check one row by hand.

Check yourself

One question. Answering it ticks this lesson off on the map; it never locks a level.

A sheet has the price in B2, the tax rate in E1, and C2 holds =B2*(1+$E$1). You copy C2 into C3. What does C3 contain?

Pick what may run on this site. You can change this any time from "Cookie settings" at the bottom of every page.