An Excel two-variable data table tests how one formula’s result changes across combinations of two input values. In Microsoft Excel for Microsoft 365 on Windows, arrange one set of test values across the top, the other down the first column, select the full grid, then choose Data > What-If Analysis > Data Table and assign the row and column input cells.
What a two-variable data table does
A two-variable data table is a what-if analysis tool. It repeatedly substitutes pairs of values into two input cells in an existing worksheet model, recalculates a formula that depends on those cells, and displays the results in a grid. It is useful when you want to compare many combinations at once rather than change an assumption, note the result, and repeat the process manually.
For example, a loan model might calculate a monthly payment from the loan amount, annual interest rate, and loan term. A two-variable table can show the payment for several interest rates and several terms while leaving the loan amount fixed. Each cell in the result area represents one pairing, such as a 5% rate with a 20-year term.
The feature is distinct from an Excel formatted table, which organizes and filters records, and from a PivotTable, which summarizes data. A what-if data table does not create new records or analyze a dataset; it runs the same model formula repeatedly with substituted inputs.
How the row and column inputs work
The table has a specific layout. The upper-left corner contains a reference to the result formula. Values to its right form the row input values, and values below it form the column input values. Excel combines each top-row value with each first-column value, temporarily places them into the model’s designated input cells, recalculates, and returns the formula result at the matching intersection.
“Row input cell” and “column input cell” describe where Excel puts the values from the table; they do not mean that you must use input cells in a particular worksheet row or column. The row input cell is the model cell that corresponds to the values across the top. The column input cell corresponds to the values down the left side.
The two input cells should be genuine model assumptions, not cells containing formulas that calculate those assumptions. The output formula should depend, directly or indirectly, on both inputs. If it does not, one or both dimensions may produce identical results. A two-variable data table returns the result of one formula for each pair; it is not a way to assign different formulas to every intersection.
Set up a two-variable data table
First build and check a normal worksheet model. Then create the grid beside it or in a clear area of the sheet. The full selection must include the formula-reference corner, the values across the top, the values down the left, and the empty result cells.
- Identify the two model input cells and the formula whose result you want to compare. Make sure changing either input affects the result.
- Enter test values across the top row and down the first column. Use consistent units and readable labels where appropriate.
- In the grid’s upper-left corner, enter a reference to the output formula cell. Do not type a copy of the result formula there.
- Select the entire grid, including the corner reference and all test values. For a grid with its corner at D8, top values in E8:H8, and left values in D9:D12, select D8:H12.
- Choose Data > What-If Analysis > Data Table. In the dialog, specify the model cell for Row input cell and the model cell for Column input cell, then select OK.
- Format the output cells as needed, such as currency or percentage, without changing the input values or the model formulas.
Excel fills the result area with calculated outputs. The table is linked to the model, so changing the model or its assumptions can affect the results. A data table is not a static report unless you copy the results and paste them as values elsewhere.
Worked example: compare loan payments
Suppose a model uses B2 for a loan principal of $200,000, B3 for the annual interest rate, B4 for the term in years, and B5 for the monthly payment. Set B3 to 5% and B4 to 30 as initial assumptions. With that layout, enter this formula in B5:
=PMT(B3/12,B4*12,-B2)
The formula divides the annual rate by 12 to get a monthly rate, converts years to monthly periods, and makes the principal negative so the payment is returned as a positive amount. At these assumptions, the monthly payment is about $1,073.64, excluding taxes, insurance, fees, and other costs.
To compare interest rates and terms, place a reference to B5 in D8. Put rates such as 4%, 5%, 6%, and 7% in E8:H8, and terms such as 15, 20, 25, and 30 in D9:D12. In this example, the table range is D8:H12. The corner reference formula, with the model output in B5 and the table corner at D8, is:
=B5
Select D8:H12 and open the Data Table dialog. Set Row input cell to B3, because the top row contains interest rates, and Column input cell to B4, because the first column contains years. Excel then calculates every rate-and-term combination while the principal in B2 stays at $200,000. The intersection of 5% and 30 years should be approximately $1,073.64, matching the model’s initial assumptions.
This example illustrates why the orientation matters: swapping the two input cells would make Excel place rates into the term cell and years into the rate cell, producing misleading results. Labels and a quick check against the model’s starting assumptions help catch that mistake.
Choose useful inputs and read the results
The table is most informative when its test values represent plausible alternatives and cover a useful range. A loan comparison could use rates in half-percentage-point increments and terms in five-year increments. A sales model might test price and unit volume; a staffing model could test hours and hourly cost. The model should hold other assumptions steady if you want to isolate the effects of these two inputs.
- Use the same units as the model expects. If the model input is an annual percentage, enter annual percentages rather than monthly rates.
- Include a row-and-column combination that matches the model’s current assumptions. Its result should agree with the model output.
- Choose enough values to reveal the pattern without making the grid needlessly large. A wide range may expose thresholds or nonlinear effects, but can be harder to interpret.
- Label the two dimensions clearly and format outputs consistently. For money, use an appropriate currency format; for rates, make clear whether entries are percentages or decimals.
Read across a row to see how changing the column variable affects results while the row variable is held at that row’s value. Read down a column to compare the other variable while the top-row value stays fixed. Look for direction and scale, not just the most favorable-looking cell: a low payment, for instance, may come with a much longer repayment period.
Common problems and how to fix them
If the table shows the same result everywhere, check that the output formula actually depends on both model input cells. Also confirm that the test values are in the intended top row and first column and that the matching input cells were assigned in the dialog. A reversed mapping can yield odd results or errors even when the table layout looks right.
If results are blank, unexpected, or stale, verify that the full grid was selected and that the upper-left cell references the intended output formula. Check the workbook’s calculation mode as well: a workbook set to Manual or Automatic Except for Data Tables may not update these results as expected during ordinary edits. In Excel, review Formulas > Calculation Options. Recalculate after correcting the setting.
Input values must be valid for the model. For example, a negative term or an interest rate in the wrong unit can lead to errors or implausible outputs. Inspect the underlying model with a single test pair before building a large table. Also check whether formulas elsewhere in the workbook use rounding, lookup thresholds, or error handling that changes how results behave at boundary values.
Data tables can increase calculation time, especially when the model is complex or the grid contains many combinations. A table with 20 row values and 30 column values requires 600 evaluations of the output formula. Reduce the number of combinations, simplify expensive formulas where possible, or recalculate only when needed if performance becomes a problem.
How data tables compare with other what-if tools
Use a two-variable data table when you want a rectangular comparison of two inputs against one output formula. A one-variable data table tests one input and can be useful when the second dimension is unnecessary. Goal Seek works in the opposite direction: it finds an input value that makes one formula reach a target, rather than displaying results for a grid of chosen values. Scenario Manager stores named sets of assumptions and is better suited to comparing a small number of distinct cases involving several changing inputs.
You can also build a manual grid with formulas that calculate each case. That approach gives more control over the layout and can make each calculation easier to inspect, but it requires careful formula references and copying. Data tables are convenient when the model already exists and the goal is to test combinations without rewriting it. For a large set of raw observations, use analysis methods suited to datasets rather than a what-if data table.
Excel version and worksheet considerations
The steps above describe Excel for Microsoft 365 on Windows. Excel for Mac also provides what-if data tables from the Data tab, though ribbon organization and dialog appearance can vary by release. Excel for the web has feature limitations; if the Data Table command is unavailable or the table cannot be edited there, open the workbook in the desktop app to create or change it.
A data table is tied to its worksheet model and its designated input cells. Keep the model and table together when practical, and add labels that explain which inputs correspond to the row and column dimensions. If you move or copy a table, check its references and test a known combination again. For sharing, consider documenting units, assumptions, and any excluded costs so readers do not mistake the grid for a complete forecast.
Frequently Asked Questions
Can an Excel data table use more than two variables?
A data table supports one or two input cells, not three or more. To compare additional assumptions, use separate tables, Scenario Manager, or a custom model grid that explicitly calculates the combinations you need.
Why does my two-variable table show the same value in every cell?
Often the output formula does not depend on one or both selected inputs, or the row and column input cells are mapped incorrectly. Confirm the formula, check the table orientation, and compare one table result with the model using the same pair of assumptions.
Does the formula go in the top-left corner of the table?
That corner should contain a reference to the formula’s result cell, not a separately rewritten calculation. Excel uses that reference to determine which output to recalculate for each input pair.
Can a two-variable data table show two different outputs?
A two-variable table is designed to return one output formula for each pair of inputs. If you need multiple measures, create a separate data table for each output or construct a custom results layout.
Why is Excel slow after I add a data table?
Excel recalculates the model for every pair in the grid. Large tables or complex formulas can take time, so use a smaller set of informative test values and check calculation settings if recalculation becomes disruptive.
Related
- Budget Tracker Spreadsheet Tips for a Clear Monthly Plan
- How to Create a PowerPoint Template in Microsoft 365
- Embed Video in PowerPoint: Steps, Formats, and Fixes
Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.
More in How-to basics
- Conditional Formatting for Absolute Values in ExcelTo conditionally format values by their absolute size in Excel for Microsoft 365 on Windows, create a formula…
- Excel Not Keeping Formatting? Causes and FixesIf Excel is not keeping formatting, first check whether the change comes from conditional formatting, a table style,…
- Google Sheets and Microsoft Excel: What to KnowGoogle Sheets is Google’s spreadsheet application, not a Microsoft product; Microsoft’s spreadsheet program is Excel. Sheets and Excel…
- Invoice Template Excel South Africa: VAT and SetupFor an invoice template in Excel for South Africa, create a workbook with supplier and customer details, a…
- How to Add Page Numbers at the Bottom of a Word DocumentTo add page numbers at the bottom of a Word document, open the Insert tab, choose Page Number…
- How to Protect a Sheet in Excel and Set PermissionsIn Excel for Microsoft 365 on Windows, open the worksheet, choose Review > Protect Sheet, select which actions…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.