Sub topic 5
Building a One-Variable Data Table
A one-variable data table recalculates a model once for each value in a list and records the result. This chapter builds a column-oriented table on the loan model, then covers the row-oriented variant, multiple outputs, and the errors that most often appear.
Prerequisites assumed: you can write formulas with absolute and relative references ($A$1 vs A1), you can format cells as percentages and currency, and you have a model where one output cell depends on a few input cells.
The model the table will run on
The table needs a model with hardcoded inputs and one formula-driven output. The loan model has three inputs and one output.
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)B2 is the cell the table will vary. It must hold a typed number, not a formula. The data table works by temporarily writing each list value into B2, recalculating the sheet, and reading B4. If B2 held a formula, the table would overwrite it only in memory, but the model would be harder to audit, and the input could not be traced to a single place.
What the table does internally
For each value in your list, Excel does the following:
- Substitutes the value into the input cell.
- Recalculates everything that depends on the input cell.
- Reads the result of the output formula.
- Writes that result into the grid.
- Restores the input cell to its original value.
The input cell on your sheet never visibly changes. Only the grid is filled in.
Building a column-oriented table
In a column-oriented table, the input values run down a column and the results appear in the column beside them. The layout is strict.
- The input values go in a single column, here D3:D7.
- The output formula goes one row above the first value and one column to the right, here E2.
- The table range you select includes the formula cell, the values, and the empty result cells: D2:E7.
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)}Follow these steps:
- Type the five rates in D3:D7 and format them as percentages.
- In E2, enter
=B4. This links the table to the model output. You can also enter the PMT formula directly, but linking keeps one source of truth. - Select D2:E7.
- Choose Data > What-If Analysis > Data Table.
- Type
B2in the Column input cell box. Leave Row input cell empty. - Click OK.
The terms are easy to mix up. "Column input cell" means the input cell that the values down a column replace. The name describes where your list sits, not where the input cell sits.
The results are monthly payments on $300,000 over 30 years. At 6.5% the payment is about $1,896.20, and at 4.5% it is about $1,520.06, so the payment rises by roughly $376 per month across the range.
Why the formula cell is shown as a number
Cell E2 displays the current payment, which is the base case. Many modelers format it with a custom number format that hides it, or label it clearly, because a stray number above the table confuses readers. A custom format of "Payment" in E2 shows the text "Payment" while the cell still holds the formula. Do not delete the formula or turn it into text.
Building a row-oriented table
A row-oriented table puts the input values across a row. The layout rotates by 90 degrees.
- The input values go in a single row, for example E2:I2.
- The output formula goes one column to the left of the first value and one row below, here D3.
- You fill in the Row input cell box and leave the column box empty.
E2:I2 (rates): 0.045, 0.055, 0.065, 0.075, 0.085
D3: =B4
Select D2:I3 > Data > What-If Analysis > Data Table
Row input cell: B2 (leave Column input cell empty)
Result in E3:I3: {=TABLE(B2,)}The array formula shows the same rule from the other side. In {=TABLE(row_input, column_input)}, the first argument is the row input cell and the second is the column input cell. The empty argument is the orientation you did not use.
| Orientation | Values go | Formula cell goes | Box to fill | Resulting formula |
|---|---|---|---|---|
| Column | Down a column | One row above, one column right of first value | Column input cell | `{=TABLE(,B2)}` |
| Row | Across a row | One column left, one row below first value | Row input cell | `{=TABLE(B2,)}` |
If you fill in the wrong box, the table still calculates. Excel substitutes the values into the cell you named, but the cell you named is the same B2, so the result may look right. The mistake shows up when you use two variables, covered in the next chapter. Even so, check the formula bar after every build.
Adding more outputs
A one-variable table can report several outputs at once. In a column-oriented table, put extra output formulas in the cells to the right of E2, in the same row.
E2: =B4 (Monthly payment)
F2: =B4*B3*12 (Total paid over the term)
G2: =B4*B3*12-B1 (Total interest)
Select D2:G7 > Data > What-If Analysis > Data Table
Column input cell: B2Each output column uses the same list of rates. Each cell in the grid is still one recalculation of the whole model, but Excel substitutes each rate once and reads all three outputs, so adding outputs is cheap compared with adding rows.
Place the output formulas directly in row 2. They can reference any cell in the model, including cells that depend on B2 through other formulas.
Checking the base case
A table that looks reasonable can still be wrong. A reliable test is to include the current input value in the list and compare the matching grid cell with the live output.
K2: =E5-B4The list contains 6.5% in D5, so E5 should equal B4. If K2 is not exactly 0, the table is not reading the model you think it is. Common causes are covered below. Keep this check cell next to the table and label it, so you notice if someone later changes the model.
You can also mark the base case visually with conditional formatting. In a one-variable table this is a rule on E3:E7 with the formula =$D3=$B$2.
Common errors in one-variable tables
| Symptom | Likely cause | Fix |
|---|---|---|
| Every result equals the same number | Output formula does not depend on the input cell, or the input cell is not the one the model reads | Trace precedents from the output. Confirm B2 feeds B4 |
| Results are all 0 or blank | Calculation mode is set to Automatic except for Data Tables | Press F9 |
| "Input cell reference is not valid" | Input cell is on a different sheet from the table | Move the table to the input sheet, or link the inputs |
| Results are off by one row | Formula cell is not exactly one row above the first value | Rebuild with the right layout |
| Results are mirrored or look swapped | Value list placed in a row but the Column input box was filled | Use the box that matches the list direction |
The same-sheet requirement
Excel only accepts an input cell on the same sheet as the data table. If your assumptions live on a separate Inputs sheet, there are two usual solutions. You can place the table on the Inputs sheet and have it read an output from the model sheet. Or you can keep a local input cell on the table sheet and make the model's input cell reference it. The second approach changes the input from a hardcode to a link, so document it.
Editing limits
The grid is one array formula. You cannot change or delete part of it. If you try to clear E4, Excel reports that you cannot change part of a data table. Select the whole result range, E3:E7, and delete it, or rebuild the table. You can change the input values in D3:D7 and the formula in E2 freely.
Calculation mode
Data tables recalculate whenever the workbook does, and in a large model that can be slow. Excel has the option Formulas > Calculation Options > Automatic except for Data Tables. With it set, tables update only when you press F9. If a table looks stale, check this setting before you suspect the formulas.
Exercise
A column-oriented table has rates in D3:D7 and the output formula in E2. You select D2:E7 and enter B1 (the loan amount) in the Column input cell box by mistake. What do you expect to see, and how would you catch it?
Show answer
Excel would substitute the rates (such as 0.045) into the loan amount B1 instead of the rate B2. The payments would be tiny numbers, around a few cents to a few dollars, because the loan would be treated as 0.045 dollars. The base case check in K2 (=E5-B4) would be far from 0 and expose the error. The formula bar would also show {=TABLE(,B1)} instead of {=TABLE(,B2)}.
Exercise
Build a row-oriented table that shows the monthly payment for terms of 10, 15, 20, 25 and 30 years. Where does the output formula go, and which input cell box do you fill in?
Show answer
Put the terms in E2:I2 and the formula =B4 in D3. Select D2:I3 and open Data Table. Enter B3 in the Row input cell box and leave the Column input cell box empty. The result is {=TABLE(B3,)} in E3:I3.