Sub topic 7
Checking the table against the base case
A data table can look finished and still be wrong. Excel does not warn you when an input cell is mislinked, when the axes are swapped, or when the grid is stale. This chapter covers a short verification routine that catches these faults before anyone reads the numbers.
This chapter assumes you have built the loan model (inputs in B1:B3, payment in B4) and both tables from the previous chapters. It also assumes you can write absolute references such as $B$2.
What the base case is
The base case is the set of inputs your model currently holds: 6.5% and 30 years in the loan model. A data table recalculates the model once for each pair of axis values. When one of those pairs equals the current inputs, that grid cell must equal the live output in B4.
This gives you a test with a known answer. The grid cell and B4 are computed from the same formulas with the same inputs, so any difference means the table is wrong. The test cannot prove every cell is right, but it does catch the errors that matter most.
The base case check confirms three things:
- The output formula in the table's corner (or header cell) points at the right output.
- The input cells you named in the dialog are the ones that drive that output.
- The row and column input cells are not swapped.
Locate the base case cell
First find which grid cell corresponds to the current inputs. Use the axis headers, not the cell's position on screen.
For the one-variable table from the earlier chapter, the rates run down D3:D7 and the outputs sit in E3:E7. The rate 6.5% is in D5, so the base case result is E5.
For the two-variable table, the rates are in D3:D7 and the years are in E2:I2 (10, 15, 20, 25, 30). The base case is 6.5% and 30 years. The rate 6.5% is in row 5, and 30 years is in column I. The base case cell is therefore I5, not E5. E5 holds 6.5% over 10 years, which is a different loan. Reading the header for each axis separately avoids this mistake.
| Table | Axis values | Base case cell |
|---|---|---|
| One-variable (rates only) | 6.5% in D5 | E5 |
| Two-variable (rates and years) | 6.5% in D5, 30 in I2 | I5 |
Write the check cell
Put a check cell outside the table range, next to it. The simplest version subtracts the model output from the base case cell:
K2: =I5-B4The result should be 0. Floating-point arithmetic can leave a trace such as 1.8E-12 when two calculation paths differ slightly. A tolerance-based version handles that and gives a clear pass or fail:
K2: =ABS(I5-B4)<0.000001K2 shows TRUE when the table agrees with the model. Label it, for example "Base case check", in J2.
Look the cell up instead of pointing at it
A hard-coded reference like I5 breaks silently if you later change the axis values. Suppose you replace 6.5% with 6.25% in the rates column. Cell I5 still exists and still holds a number, but it no longer represents the base case. A lookup finds the matching cell from the current inputs:
K3: =INDEX($E$3:$I$7, MATCH($B$2,$D$3:$D$7,0), MATCH($B$3,$E$2:$I$2,0))
K4: =ABS(K3-B4)<0.000001MATCH(...,0) requires an exact match. If the current rate is not on the rate axis, MATCH returns #N/A. That error is useful because it tells you the table has no base case row, which is a design problem in its own right (see below).
Exact matching works for typed constants like 0.065. If an input is the result of a calculation, such as =0.05+0.015, it may differ from the axis value in the last binary digit and fail to match. Keep the inputs and the axis values as typed numbers.
Keep the check cell outside the table
Do not put the check cell inside the selected range D2:I7. Excel treats every interior cell of the range as part of the {=TABLE(...)} array and will not let you edit it. Put the check beside or below the grid, outside the selection.
The verification routine
The routine below is short enough to run every time you build or modify a table.
Step 1: Recalculate first
If the workbook is set to Automatic except for Data Tables, the grid may hold values from before your last change. Press F9 before testing. A stale table can fail the check even though it is built correctly.
Step 2: Compare the base case
Read the check cell. TRUE or zero means the table passes the base case test. Anything else means something is broken. Go to the diagnosis section below.
Step 3: Spot check one corner
A passing base case does not guarantee the other cells are right. Pick a cell far from the base case, such as 4.5% over 10 years in E3, and compute it directly with a normal formula:
K5: =PMT(0.045/12, 10*12, -B1)
K6: =ABS(E3-K5)<0.000001This formula does not use the data table, so it is an independent calculation. The two should agree. If you can, also test a corner on the other axis, such as 8.5% over 30 years in I7.
A third inexpensive check is whether the pattern makes sense. In the loan model, the payment must rise as the rate rises (down each column) and fall as the term lengthens (left to right across each row). A grid that breaks this pattern has a wiring error.
Diagnose a failed check
The way the check fails usually points to the cause.
| Symptom | Likely cause | Fix |
|---|---|---|
| Every grid cell shows the same number, equal to B4 | The input cells you chose do not affect the output, for example B4 uses typed numbers instead of references to B2 and B3 | Make the output depend on the input cells |
| Grid values are nonsense, such as huge or negative payments | Row and column input cells are swapped, so rates are being fed in as years | Delete the table and rebuild with the row input matching the top axis |
| Base case cell is close but not equal | Stale grid, or the table was built before an input changed | Press F9 and check the calculation mode |
| Check returns `#N/A` | Current inputs are not on the axes | Add the base case value to each axis |
| Grid cells are right but the check references the wrong cell | Hard-coded pointer such as `I5` no longer matches | Use the INDEX and MATCH version |
Swapped axes in detail
A swap is the most common wiring error and the least obvious one. The dialog asks for a row input cell and a column input cell, and the names refer to where the values sit. The values across the top row replace the row input cell. The values down the left column replace the column input cell. In the loan table, the years run across the top, so the row input cell is B3 (term). The rates run down the side, so the column input cell is B2 (rate).
If you reverse them, Excel feeds 0.045 into the term cell and 10 into the rate cell. It will not report an error. The base case check fails because the result does not match B4, which makes the check the main way to detect the mistake.
A flat grid in detail
A flat grid means the table ran, but changing the input cell did nothing. The usual cause is that the output formula does not depend on that cell. For example, if B4 were =PMT(0.065/12, B3*12, -B1), the rate is typed inside the formula. The data table would substitute values into B2, but nothing reads B2, so each row repeats the same answer. The base case check passes in that case, because every cell equals B4 at the base inputs. The check passes while the grid is still wrong. This is why the spot check and the pattern check are part of the routine, and why you should always look at whether the grid varies.
When the base case is not on the axes
Sometimes the table axes are deliberately round numbers that exclude the current inputs, such as 5%, 6%, 7%. Then there is no base case cell, and the lookup version returns #N/A. You have two options:
- Add the current value to each axis, so a grid cell exists for it. This is the better option because it also lets you highlight the base case (covered in the formatting chapter).
- Temporarily set the input cell to one of the axis values, press F9, and compare that grid cell with B4. Then restore the original input.
The second option works, but you must remember to restore the input. Option 1 leaves a permanent check in the model.
Summary of the routine
- Press F9.
- Compare the base case grid cell with the model output, using a check cell outside the table.
- Spot check a far corner with a direct formula.
- Confirm the pattern is plausible in both directions.
- If anything fails, test calculation mode, axis orientation, and input links, in that order.
Exercise
In a two-variable table, the rates are in D3:D7 (4.5%, 5.5%, 6.5%, 7.5%, 8.5%) and the years are in E2:I2 (10, 15, 20, 25, 30). The current inputs are 7.5% and 20 years. Which grid cell is the base case, and what formula in K2 tests it with a tolerance?
Show answer
7.5% is in D6, which is row 6. 20 years is in G2, which is column G. The base case cell is G6. The formula is =ABS(G6-B4)<0.000001, which returns TRUE when the table matches the model.
Exercise
You build a two-variable table and every cell shows 1,896.20, the same as B4. The base case check returns TRUE. What is the likely problem, and how do you confirm it?
Show answer
The output formula probably does not depend on the input cells, for example because the rate or term is typed inside the PMT formula instead of referencing B2 and B3. The base case check passes because every cell equals B4. To confirm, compute an off-base cell such as 4.5% over 10 years directly with =PMT(0.045/12,10*12,-B1). It will differ from the grid value, which shows the grid is flat. Fix B4 so that it references B2 and B3.