Sub topic 3
How an Excel data table works
This chapter explains what Excel does when you create a data table. It covers how the layout maps to the results and what a table cannot do. The step-by-step builds for one-variable and two-variable tables come in later chapters. Here you build the mental model that makes those builds predictable.
You should already be comfortable with cell references, absolute references ($B$2), and a simple model with hardcoded inputs and one formula-driven output. The running example is a loan payment model.
What a data table does
A data table is a Excel feature, found under Data > What-If Analysis > Data Table, that answers one question many times. The question is: "What would this output be if one or two inputs had different values?"
You give Excel three things:
- A formula cell that holds the output you care about.
- A list of alternative values for one input, or two lists for two inputs.
- The input cell or cells in your model that those values should replace.
Excel then fills a grid with the output for every alternative. You never copy the model, and you never write a formula per row. The grid is a sensitivity table: a compact view of how the output moves as the inputs move.
A data table is not a formula you write. It is a command that Excel stores as a special array formula, and Excel runs a full recalculation of your model for each cell in the grid.
The model the table runs on
Here is the loan model from the plan. The inputs are hardcoded constants, and the output is a formula that depends on them.
B1: 300000 (Loan amount)
B2: 0.065 (Annual interest rate)
B3: 30 (Term in years)
B4: =PMT(B2/12, B3*12, -B1) (Monthly payment, the output)With these inputs, B4 shows 1,896.20. A data table can show you what B4 would be at 4.5%, 5.5%, 7.5%, and 8.5% without you editing B2 by hand each time.
The substitution loop
Excel does the following for each value in your list. It does this internally. You never see the intermediate states on screen.
- Take the next value from the row or column of alternatives.
- Place that value into the input cell, temporarily.
- Recalculate every cell that depends on the input cell.
- Read the result of the output formula.
- Store that result in the matching grid cell.
- Restore the input cell to its original value after the last grid cell is done.
Two consequences follow from this loop.
- The input cell must feed the output formula through ordinary cell references. If the output does not depend on the input cell, every substitution produces the same result and the grid is flat.
- The table is only as accurate as your model. Excel does not check whether the model makes sense. It only repeats it.
Layout: where each piece goes
The position of the formula and the lists is what tells Excel how to build the grid. Excel reads the selected range, so the layout rules are strict.
Here is the one-variable, column-oriented table from the plan. The rates run down column D, and the output formula sits one row above the first rate and one column to the right.
D3:D7 (rates): 0.045, 0.055, 0.065, 0.075, 0.085
E2: =B4
Select D2:E7 > Data > What-If Analysis > Data Table
Column input cell: B2 (leave Row input cell empty)
Result in E3:E7: {=TABLE(,B2)}The resulting grid looks like this:
| Rate (D) | Payment (E) |
|---|---|
| (D2 is blank or a label) | `=B4` shows 1,896.20 |
| 4.5% | 1,520.06 |
| 5.5% | 1,703.37 |
| 6.5% | 1,896.20 |
| 7.5% | 2,097.64 |
| 8.5% | 2,306.59 |
Read the grid from left to right. Each row says: "If B2 were this rate, B4 would be this payment."
The selection D2:E7 includes the blank corner D2, the formula E2, the rates, and the result cells. Excel treats the first column of the selection as the list of values and the first row as the formulas. It writes results into everything else.
Column versus row orientation
The orientation you choose changes where the formula goes and which input box you fill.
| Orientation | Values go | Formula goes | Input box to fill |
|---|---|---|---|
| Column | Down the first column | One row above the first value, one column to the right | Column input cell |
| Row | Across the first row | One column left of the first value, one row below | Row input cell |
The names refer to where the values sit, not to where the input cell sits. If your values run down a column, you fill in the column input cell. This is a very common source of mistakes, and the later chapter on pitfalls returns to it.
Adding a second variable
With two variables, the layout changes. The formula moves to the top-left corner, one list runs across the top, and the other runs down the side.
D2: =B4
E2:I2 (years): 10, 15, 20, 25, 30
D3:D7 (rates): 0.045, 0.055, 0.065, 0.075, 0.085
Select D2:I7 > Data > What-If Analysis > Data Table
Row input cell: B3 (term, matches the values across the top)
Column input cell: B2 (rate, matches the values down the side)
Result in E3:I7: {=TABLE(B3,B2)}Each grid cell now has a pair of substitutions. For the cell in the 5.5% row and the 20-year column, Excel puts 0.055 in B2 and 20 in B3, recalculates, and reads D2. A two-variable table can show only one output formula, because the corner cell is the only formula position. If you need two outputs, you build two tables.
What the table does to your workbook
The grid cells hold {=TABLE(row_input, column_input)}. The braces mean it is an array formula, and the grid is a single unit. Three things follow.
- You cannot type
TABLEyourself. You can only create it through the dialog box. - You cannot edit or delete part of the grid. Excel reports "Cannot change part of a data table." To change it, select the whole result range and delete it, or rerun the dialog.
- The input cell does not visibly change. After the table calculates,
B2still shows 6.5%.
A later chapter covers the array formula and its editing limits in detail. For now, remember that the grid is one object, and the dialog box is the way to define it.
A worked trace
Trace the cell in E3, the first result in the one-variable table.
- Excel reads the value in
D3, which is 0.045. - It places 0.045 into
B2, the column input cell. - It recalculates
B4, which now computes=PMT(0.045/12, 360, -300000). - It reads
E2, which points toB4, and gets 1,520.06. - It writes 1,520.06 into
E3.
It repeats this for D4 through D7. Then B2 goes back to 0.065, and B4 shows 1,896.20 again.
The 6.5% row is the base case. Its result should match B4, which is the idea behind the base-case check covered later in this tutorial.
Common misreadings
- "The table changes my inputs." It does not. It substitutes values during calculation and restores the original input afterward.
- "The table makes the model run faster." It does the opposite. Each grid cell is a full recalculation, so a 5 by 5 two-variable table triggers 25 recalculations of everything that depends on the input cells. A later chapter on performance covers this.
- "The top-left cell of a one-variable table is part of the data." In a column-oriented one-variable table,
D2is not used. You can leave it blank or put a label there. - "Any cell in my workbook can be an input cell." Not quite. The input cell has rules about where it lives and what it contains. The next chapter covers them, so for now use hardcoded inputs on the same sheet as the table.
Summary of the working model
- A data table repeats your model once per grid cell, substituting values into one or two input cells.
- Its position rules are strict: values on the edge, formula at the corner or offset, results inside.
- The result cells are one
{=TABLE(...)}array that you can only change through the dialog. - The row and column input cells are named for where the values sit, not for where the input cell is.
Exercise
In the loan model, you build a column-oriented one-variable table with rates in D3:D7 and the formula =B4 in E2. You select D2:E7 and open the Data Table dialog. Which box do you fill with B2, and what does Excel do with B2 for the cell in row 5 of the grid?
Show answer
Fill in the Column input cell, because the rates run down a column. For the row-5 grid cell, which sits beside the 6.5% rate in D5, Excel temporarily places 0.065 in B2, recalculates the model, reads the result of E2 (which is B4), and writes it in the grid cell. It then restores B2 to its original value.
Exercise
A colleague builds a two-variable table on the loan model with the corner formula =B4, interest rates across the top, and terms down the side. They set Row input cell to B3 and Column input cell to B2. The grid shows plausible numbers, but the payments look wrong. What is the likely mistake, and how do you confirm it?
Show answer
The input cells are swapped relative to the layout. Rates run across the top, so they are the row values and need the row input cell, B2. Terms run down the side, so they need the column input cell, B3. As built, Excel puts rates into the term cell and terms into the rate cell. To confirm, compare the grid cell where the headers equal the current inputs (6.5% and 30 years) with B4. They will not match.