Sub topic 4
Input cells: what they must be and where they must live
This chapter assumes you can build a small model with hardcoded inputs and a formula-driven output, such as the loan payment model in B1:B4. It also assumes you are comfortable with absolute references. Here you will learn the rules that decide whether a data table works. Most failed tables break one of these rules.
What an input cell is
A data table does not read your formulas. It runs a substitution loop. For each value in the table's axis, Excel does the following:
- Writes that value into the input cell.
- Recalculates the model.
- Reads the result of the output formula.
- Stores that result in the grid cell.
- Restores the original value of the input cell.
The input cell is the cell that Excel overwrites temporarily. Everything the table can show depends on one fact: the output formula must depend, directly or through a chain of other cells, on that input cell.
Because Excel only substitutes values, the table cannot tell you what you meant. It reports what the model does when that one cell changes.
Rule 1: the input cell must be a hardcoded value
The input cell should hold a typed constant, such as 0.065 in B2. It should not hold a formula.
If B2 contained =Assumptions!C5, Excel would still write the axis values into B2 during the table calculation, and the table may display correct numbers. This is fragile. Many modelers avoid it, and it hides the real input from anyone who reads the table. A better approach is to keep the real assumption on the same sheet as the table and have the rest of the model read from it.
In the loan model, the correct structure is:
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)B1, B2, and B3 are constants. B4 depends on all three. Any of the three can be an input cell.
Rule 2: the output must depend on the input cell
This is the cause of the flat grid, where every result in the table is the same number. If the output formula does not reference the input cell, directly or indirectly, then changing the input cannot change the output.
Two common ways to break the dependency:
- A pasted value in the chain. Someone replaced a formula between the input and the output with its value. The model still shows a number, but the link is gone.
- A second copy of the input. The output reads from a different cell that happens to contain the same number. For example, the PMT formula refers to a cell typed as 0.065 in another location, while B2 is a decoy.
A quick test: select the output cell and use Formulas > Trace Precedents. Follow the arrows back. If the input cell you plan to use is not in the chain, the table will be flat.
Rule 3: the input cell must be on the same sheet as the table
Excel requires that the input cells you name in the Data Table dialog be on the same worksheet as the table itself. If you select a cell on another sheet, Excel shows the message "Input cell reference is not valid."
The model's calculations can live on other sheets. Only the input cells have to be local. The standard workaround is:
- Put the table on the sheet that holds the assumptions, or
- Add an input cell on the table's sheet, and change the model's assumptions sheet so that it reads from that cell.
The second option reverses the usual direction of links. It is common in financial models, and you should document it with a label so that other users know where the live input is.
Rule 4: axis values are values, not formulas that depend on the input
The values along the top row and left column of the table are what Excel writes into the input cells. They can be typed constants, or formulas, but a formula must not depend on the input cell it is going to replace.
Consider a rate axis built as =$B$2-0.01, =$B$2, =$B$2+0.01. During the table calculation Excel changes B2. The axis cells recalculate as B2 changes, so the values being substituted move while the loop is running. The result is a grid with wrong or inconsistent numbers, and there is no error message.
Two safe patterns:
- Type the axis values as constants.
- Build the axis from a separate cell that is not the input cell, such as a "center rate" cell, and a step cell. Then the base-case rate in B2 can be linked from the center, and the axis does not depend on B2.
Rule 5: the output formula sits in a fixed position
The position of the output formula depends on the table type.
| Table type | Where the output formula goes | Where the axis values go |
|---|---|---|
| One-variable, column-oriented | One row above the first value, one column to the right of the value column | Down a column |
| One-variable, row-oriented | One column to the left of the first value, one row below the value row | Across a row |
| Two-variable | Top-left corner of the selected range | Top row and left column |
In the column-oriented example, the rates are in D3:D7 and the formula is in E2, as in =B4. You can link to the model's output cell, which is better than retyping the model logic. The table will then always track the model.
Mapping the dialog fields to the grid
Excel asks for a row input cell and a column input cell. The names refer to where the axis values lie, not where the input cell sits.
- The row input cell receives the values in the top row of the table.
- The column input cell receives the values in the left column of the table.
A wrong-axis result is the most common two-variable error. If you reverse the two fields, Excel does not warn you. It writes the years into the rate cell and the rates into the term cell. The numbers look plausible at a glance but are wrong.
For the two-variable loan table:
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)}The years run across the top, so the row input cell is B3, the term. The rates run down the side, so the column input cell is B2, the rate. Notice that the formula {=TABLE(B3,B2)} lists the row input first and the column input second.
If you enter B2 as the row input and B3 as the column input, Excel would try to place 10 to 30 into the rate cell, which gives a monthly rate of 1000% to 3000% divided by 12. The resulting payments look like nonsense, and that is your signal. A less extreme swap, such as two inputs with similar magnitudes, may not look wrong at all. That is why the base-case check in the next chapters matters.
Rule 6: one input cell per axis
Each axis feeds exactly one input cell. If you want to vary two assumptions together, such as a rate and a spread that move in step, there are two options:
- Create a single driver cell, for example "rate shift", that both assumptions reference. Use that cell as the input.
- Use the two-variable table to show the grid of both, if you want all combinations rather than a paired move.
Rule 7: keep the inputs untouched by other logic
Do not place the input cell where a macro, a circular reference, or a formula can overwrite it during the calculation. If the model contains a circular reference, such as interest calculated on an average debt balance with iterative calculation turned on, data tables can produce unstable results because each substitution starts an iteration. Test such models carefully, or break the circularity with a copy-paste macro or a closed-form approximation.
A pre-flight checklist
Before you open the Data Table dialog, confirm each of these:
- The input cell holds a typed constant.
- The input cell is on the same sheet as the table.
- Trace Precedents from the output shows the input cell in the chain.
- The axis values are constants, or depend only on cells other than the input cells.
- The output formula is in the correct position for the table type.
- You know which axis is the row and which is the column.
Quick diagnosis by symptom
| Symptom | Likely cause | Fix |
|---|---|---|
| Every grid cell shows the same number | Output does not depend on the input cell | Trace Precedents and restore the link |
| "Input cell reference is not valid" | Input cell is on another sheet | Move the table, or move the live input to the table's sheet |
| Values look scaled wrongly or absurd | Row and column input cells are swapped | Delete the table and redo it with the fields reversed |
| Grid values shift oddly or are inconsistent | Axis values depend on the input cell | Replace them with constants or a separate center cell |
| Results differ from the model at the base case | Axis does not contain the base values, or the table is stale | Add base values to the axes and recalculate with F9 |
Exercise
Your two-variable table has interest rates down the left column (D3:D7) and loan terms across the top row (E2:I2). The rate input is B2 and the term input is B3. Which cell goes in "Row input cell" and which goes in "Column input cell"? What would the resulting TABLE formula look like? Then explain why a rate axis defined as =$B$2-0.01, =$B$2, =$B$2+0.01 would corrupt the grid.
Show answer
Row input cell is B3, because the top row holds the terms. Column input cell is B2, because the left column holds the rates. The formula is {=TABLE(B3,B2)}, with the row input listed first. The rate axis built from B2 corrupts the grid because Excel overwrites B2 with each axis value during the loop. The axis cells depend on B2, so they recalculate while being substituted, and the values written into B2 are no longer the values you intended. Use typed constants, or a separate center-rate cell that does not depend on B2.
Exercise
A colleague's one-variable data table returns the same monthly payment in every row. The input cell B2 contains 0.065 and is on the same sheet as the table. List two checks you would make to find the cause.
Show answer
First, select the output cell and run Trace Precedents to confirm B2 is in its dependency chain. A pasted value or a second copy of the rate elsewhere breaks the chain. Second, check that the Column input cell in the table is B2 and not an empty or unrelated cell, by looking at the TABLE formula in the grid. You could also check that calculation is not set to Automatic except for Data Tables without a recalculation having been run (press F9).