What-If Analysis in Excel: Build a Data Table
By ExcelReady TeamUpdated 6 min read
The short answer
A data table is a What-If Analysis tool that runs one formula with many different inputs and shows every result in a grid. List the input values next to the formula, select the block, go to Data > What-If Analysis > Data Table, and pick which cell each list replaces: the row input cell, the column input cell, or both.
Key takeaways
- A data table recalculates one formula for every value in a list and writes all the results at once.
- A one-variable table uses a column input cell (or a row input cell); a two-variable table uses both.
- The input cells must be on the same sheet as the data table.
- Results are a {=TABLE()} array: you can't edit one cell, only clear the whole result area.
- In a big workbook, set Calculation Options to Automatic Except for Data Tables and press F9 to update.
On this page+
A what-if analysis data table shows how one formula's answer changes when you change one or two of its inputs. Instead of typing a new interest rate, writing down the payment and trying the next rate, you list all the rates once and Excel fills in every result in one grid. This guide is for anyone who builds budgets, loan models or price plans and wants to compare many "what if" cases side by side.
What is a data table in Excel?#
A data table is one of three What-If Analysis tools in Excel, next to Goal Seek and Scenario Manager. It takes a formula that already works, swaps in each value from a list, and writes each result into a grid.
- One-variable data table: one input changes, such as the interest rate. You get one column (or row) of results.
- Two-variable data table: two inputs change, such as the rate and the loan term. You get a full grid of results.
Goal Seek works the other way: you give it the result you want and it finds one input. Scenario Manager saves named sets of several inputs. A data table is the best of the three when you want to see a whole range of answers at once.
All the examples use this loan model in A1:B4:
| A | B | |
|---|---|---|
| 1 | Loan | 20,000 |
| 2 | Rate (yearly) | 6% |
| 3 | Months | 48 |
| 4 | Monthly payment | =PMT(B2/12,B3,-B1) |
B4 returns 469.70. The minus sign in front of B1 makes the payment positive. The guide to the PMT function explains each argument.
How to build a one-variable data table#
A one-variable data table lists input values down a column, with the formula one row above and one column to the right of the first value. Here is how to test five interest rates:
- In A8:A12, type the rates 4%, 5%, 6%, 7% and 8%.
- In B7, one row above the first rate and one column to the right, type
=B4. This points at the payment formula. - Select A7:B12, the formula and the rates together.
- Go to Data > What-If Analysis > Data Table (in the Forecast group on Windows; on a Mac it is also under Data > What-If Analysis).
- Leave Row input cell empty. In Column input cell, click B2, the rate cell.
- Click OK.
Excel fills B8:B12 with the payment for each rate:
| Rate | Monthly payment |
|---|---|
| 4% | 451.58 |
| 5% | 460.59 |
| 6% | 469.70 |
| 7% | 478.92 |
| 8% | 488.26 |
The column input cell is "the cell my column of values replaces". Excel puts 4% into B2 behind the scenes, reads B4, writes the answer, and moves on to 5%. Your real B2 never changes.
How to build a two-variable data table#
A two-variable data table puts the formula in the top-left corner, one input across the top row and the other down the left column. Here is rate against loan term:
- In A15, type
=B4. - In B15:D15, type the terms 36, 48 and 60.
- In A16:A18, type the rates 5%, 6% and 7%.
- Select A15:D18 and open Data > What-If Analysis > Data Table.
- Row input cell: B3 (the months, because the terms run across the row).
- Column input cell: B2 (the rate, because the rates run down the column).
| Rate \ Months | 36 | 48 | 60 |
|---|---|---|---|
| 5% | 599.42 | 460.59 | 377.42 |
| 6% | 608.44 | 469.70 | 386.66 |
| 7% | 617.54 | 478.92 | 396.02 |
The most common mistake is swapping the two input cells. If the numbers look strange, check that the row input cell matches the values in the top row.
Why can't I edit one cell of a data table?#
Excel writes the results as one array formula, {=TABLE(B3,B2)}, across the whole result area. You can't type over, move or delete a single cell of it. Excel shows "Cannot change part of a data table", the same kind of message explained in why Excel says you can't change part of an array.
To change the table:
- Change the inputs in the top row or left column. The results update.
- Change the model in A1:B4. The whole table recalculates.
- Delete the table: select every result cell (B16:D18 in the example) and press Delete.
How to keep a big data table from slowing Excel down#
A data table recalculates every time anything in the workbook changes, so a large one can make Excel slow. The fix is a calculation setting:
- Go to Formulas > Calculation Options.
- Choose Automatic Except for Data Tables.
- Press F9 when you want the tables to update (on a Mac, you may need Fn+F9).
Remember that the table now shows old numbers until you press F9. If every cell shows the same value, this setting is usually the reason.
Data table rules and limits#
A data table is quick to build, but it has firm rules:
- Same sheet only. The row and column input cells must be on the sheet that holds the table.
- One or two inputs. For three or more changing inputs, use Scenario Manager or build the grid with formulas.
- The formula must depend on the input cell. If B4 doesn't use B2, changing the rate does nothing and every result looks the same.
- Values, not formulas, in the input lists work best. Typed rates and terms are easiest to check.
Data table or a grid of formulas?#
You can build the same grid with ordinary formulas and $ signs, and many people prefer it because you can see and audit every cell. For the one-variable table, type this in B8 and fill down:
=PMT(A8/12,$B$3,-$B$1)The $ signs lock the months and the loan, while A8 moves down to each new rate. For a two-variable grid you need mixed references like $A16 and B$15 so one part locks the column and the other locks the row. The guide to absolute references and the dollar sign covers the basics.
Use a data table when the model is long (a full budget or a loan amortization schedule) and you only want to vary its inputs. Use a grid of formulas when the calculation fits in one cell. The same idea works for profit: vary the price or the units and watch the result, as in this break-even analysis in Excel. You can also vary a percentage, such as a cost increase of 2%, 4% or 6%, and read the new totals.
Practise it#
Data tables only work if the model under them is right, and that means solid $ references. Practise absolute references in a live spreadsheet: you fill formulas across and down and see straight away when a reference drifts. Then practise a budget model with simple maths and practise percent change, the two calculations most what-if tables test. Or start with the exercise on this page.
Try it yourself
This is a live spreadsheet. Type the formula in the green cell and press Enter.
Build one row of a rate table by hand. Click B6 and use PMT for the rate in A6, locking the months (B3) and the loan (B1) with $ signs. Round to 2 decimals and make the payment positive.
| A | B | C | D | |
|---|---|---|---|---|
| 1 | ||||
| 2 | ||||
| 3 | ||||
| 4 | ||||
| 5 | Payment | |||
| 6 | ||||
| 7 | ||||
| 8 | ||||
| 9 | ||||
| 10 | ||||
| 11 |
Tip: Divide the yearly rate in A6 by 12, use $B$3 for the months and -$B$1 for the loan, then wrap it all in ROUND(..., 2).
Practise this in a lesson
Frequently asked questions
What is a data table in Excel what-if analysis?
It is a range of cells that shows how one formula's result changes when one or two of its inputs change. Excel fills the grid with a result for every input value you list.
What is the difference between the row input cell and the column input cell?
The row input cell is the cell your values across the top row replace. The column input cell is the cell your values down the left column replace. A one-variable table listed down a column only needs the column input cell.
Why does my data table show the same value in every cell?
Usually calculation is set to Automatic Except for Data Tables, so press F9. Otherwise the input cell is wrong: it must be the cell the formula actually uses, such as the rate cell, not the formula cell.
Can a data table use an input cell on another sheet?
No. The input cells must be on the same sheet as the table. Put the table next to your inputs, or link a cell on the table's sheet to the other sheet and point the formula at that.
How do I delete a data table in Excel?
Select all of the result cells, not just one, and press Delete. Excel won't let you change or delete part of a data table on its own.