You are on page 1of 23

# Data Tables

## One Variable Data Table | Two Variable Data Table

Instead of creating different scenarios you can create a data table to quickly try out different
values for formulas. You can create a one variable data table or a two variable data table.
Assume you own a book store and have 100 books in storage. You sell a certain % for the
highest price of \$50 and a certain % for the lower price of \$20. If you sell 60% for the highest
price, cell D10 below calculates a total profit of 60 * \$50 + 40 * \$20 = \$3800.
One Variable Data Table
To create a one variable data table, execute the following steps.
1. Select cell B12 and type =D10 (refer to the total profit cell).
2. Type the different percentages in column A.
3. Select the range A12:B17.
We are going to calculate the total profit if you sell 60% for the highest price, 70% for the
highest price, etc.

4. On the Data tab, click What-If Analysis and select Data Table from the list.

5. Click in the 'Column input cell' box (the percentages are in a column) and select cell C4.
We select cell C4 because the percentages refer to cell C4 (% sold for the highest price).
Together with the formula in cell B12, Excel now knows that it should replace cell C4 with 60%
to calculate the total profit, replace cell C4 with 70% to calculate the total profit, etc.

Note: this is a one variable data table so we leave the Row input cell blank.
6. Click OK.
Result.

Conclusion: if you sell 60% for the highest price, you obtain a total profit of \$3800, if you sell
70% for the highest price, you obtain a total profit of \$4100, etc.
Note: the formula bar indicates that the cells contain an array formula. Therefore, you cannot
delete a single result. To delete the results, select the range B13:B17 and press Delete.
Two Variable Data Table
To create a two variable data table, execute the following steps.
1. Select cell A12 and type =D10 (refer to the total profit cell).
2. Type the different unit profits (highest price) in row 12.
3. Type the different percentages in column A.
4. Select the range A12:D17.
We are going to calculate the total profit for the different combinations of 'unit profit (highest
price)' and '% sold for the highest price'.

5. On the Data tab, click What-If Analysis and select Data Table from the list.

6. Click in the 'Row input cell' box (the unit profits are in a row) and select cell D7.
7. Click in the 'Column input cell' box (the percentages are in a column) and select cell C4.
We select cell D7 because the unit profits refer to cell D7. We select cell C4 because the
percentages refer to cell C4. Together with the formula in cell A12, Excel now knows that it
should replace cell D7 with \$50 and cell C4 with 60% to calculate the total profit, replace cell
D7 with \$50 and cell C4 with 70% to calculate the total profit, etc.

8. Click OK.
Result.

Conclusion: if you sell 60% for the highest price, at a unit profit of \$50, you obtain a total profit
of \$3800, if you sell 80% for the highest price, at a unit profit of \$60, you obtain a total profit of
\$5200, etc.
Note: the formula bar indicates that the cells contain an array formula. Therefore, you cannot
delete a single result. To delete the results, select the range B13:D17 and press Delete.

What-If Analysis

Create Different Scenarios | Scenario Summary | Goal Seek
What-If Analysis in Excel allows you to try out different values (scenarios) for formulas. The
following example helps you master what-if analysis quickly and easily.
Assume you own a book store and have 100 books in storage. You sell a certain % for the
highest price of \$50 and a certain % for the lower price of \$20.

If you sell 60% for the highest price, cell D10 calculates a total profit of 60 * \$50 + 40 * \$20 =
\$3800.
Create Different Scenarios
But what if you sell 70% for the highest price? And what if you sell 80% for the highest price?
Or 90%, or even 100%? Each different percentage is a different scenario. You can use the
Scenario Manager to create these scenarios.
Note: You can simply type in a different percentage into cell C4 to see the corresponding result
of a scenario in cell D10. However, what-if analysis enables you to easily compare the results of
1. On the Data tab, click What-If Analysis and select Scenario Manager from the list.

The Scenario Manager dialog box appears.

3. Type a name (60% highest), select cell C4 (% sold for the highest price) for the Changing cells
and click on OK.

4. Enter the corresponding value 0.6 and click on OK again.

5. Next, add 4 other scenarios (70%, 80%, 90% and 100%).
Finally, your Scenario Manager should be consistent with the picture below:

Note: to see the result of a scenario, select the scenario and click on the Show button. Excel will
change the value of cell C4 accordingly for you to see the corresponding result on the sheet.
Scenario Summary
To easily compare the results of these scenarios, execute the following steps.
1. Click the Summary button in the Scenario Manager.
2. Next, select cell D10 (total profit) for the result cell and click on OK.

Result:

Conclusion: if you sell 70% for the highest price, you obtain a total profit of \$4100, if you sell
80% for the highest price, you obtain a total profit of \$4400, etc. That's how easy what-if
analysis in Excel can be.
Goal Seek
What if you want to know how many books you need to sell for the highest price, to obtain a
total profit of exactly \$4700? You can use Excel's Goal Seek feature to find the answer.
1. On the Data tab, click What-If Analysis, Goal Seek.

The Goal Seek dialog box appears.
2. Select cell D10.
3. Click in the 'To value' box and type 4700.
4. Click in the 'By changing cell' box and select cell C4.
5. Click OK.

Result. You need to sell 90% of the books for the highest price to obtain a total profit of exactly
\$4700.

Are you using OpenOffice? Download this awesome calendar tool for OpenOffice. It's 100%
free.
Go to Top: What-If Analysis | Go to Next Chapter: Sol

Data table basics
You can create one-variable or two-variable data tables, depending on the number of variables
and formulas that you want to test.
One-variable data tables Use a one-variable data table if you want to see how different values
of one variable in one or more formulas will change the results of those formulas. For example,
you can use a one-variable data table to see how different interest rates affect a monthly
mortgage payment by using the PMT function. You enter the variable values in one column or
row, and the outcomes are displayed in an adjacent column or row.
In the following illustration, cell D2 contains the payment formula, =PMT(B3/12,B4,-B5),
which refers to the input cell B3.

A one-variable data table

Two-variable data tables Use a two-variable data table to see how different values of two
variables in one formula will change the results of that formula. For example, you can use a two-
variable data table to see how different combinations of interest rates and loan terms will affect a
monthly mortgage payment.
In the following illustration, cell C2 contains the payment formula, =PMT(B3/12,B4,-B5),
which uses two input cells, B3 and B4.

A two-variable data table

Data table calculations Data tables are recalculated whenever a worksheet is recalculated,
even if they have not changed. To speed up calculation of a worksheet that contains a data table,
you can change the Calculation options to automatically recalculate the worksheet but not the
data tables. See the section Speed up calculation in a worksheet that contains data tables.
Top of Page
Create a one-variable data table
A one-variable data table has input values that are listed either down a column (column-oriented)
or across a row (row-oriented). Formulas that are used in a one-variable data table must refer to
only one input cell.
1. Type the list of values that you want to substitute in the input cell either down one column or
across one row. Leave a few empty rows and columns on either side of the values.
2. Do one of the following:
If the data table is column-oriented (your variable values are in a column), type the formula in
the cell one row above and one cell to the right of the column of values. The one-variable data
table illustration shown in the Overview section is column-oriented, and the formula is
contained in cell D2.
If you want to examine the effects of various values on other formulas, type the additional
formulas in cells to the right of the first formula.
If the data table is row-oriented (your variable values are in a row), type the formula in the cell
one column to the left of the first value and one cell below the row of values.
If you want to examine the effects of various values on other formulas, type the additional
formulas in cells below the first formula.
3. Select the range of cells that contains the formulas and values that you want to substitute.
Based on the first illustration in the preceding Overview section, this range is C2:D5.
4. On the Data tab, in the Data Tools group, click What-If Analysis, and then click Data Table.
5. Do one of the following:
If the data table is column-oriented, type the cell reference for the input cell in the Column
input cell box. Using the example shown in the first illustration, the input cell is B3.
If the data table is row-oriented, type the cell reference for the input cell in the Row input cell
box.
Note After you create your data table, you might want to change the format of the result cells.
In the illustration, the result cells are formatted as currency.
Top of Page
Add a formula to a one-variable data table
Formulas that are used in a one-variable data table must refer to the same input cell.
1. Do one of the following:
If the data table is column-oriented (your variable values are in a column), type the new formula
in a blank cell to the right of an existing formula in the top row of the data table.
If the data table is row-oriented (your variable values are in a row), type the new formula in a
blank cell below an existing formula in the first column of the data table.
2. Select the range of cells that contains the data table and the new formula.
3. On the Data tab, in the Data Tools group, click What-If Analysis, and then click Data Table.
4. Do one of the following:
If the data table is column-oriented, type the cell reference for the input cell in the Column
input cell box.
If the data table is row-oriented, type the cell reference for the input cell in the Row input cell
box.
Top of Page
Create a two-variable data table
A two-variable data table uses a formula that contains two lists of input values. The formula
must refer to two different input cells.
1. In a cell on the worksheet, enter the formula that refers to the two input cells.
In the following example, in which the formula's starting values are entered in cells B3, B4, and
B5, you type the formula =PMT(B3/12,B4,-B5) in cell C2.
2. Type one list of input values in the same column, below the formula.
In this case, type the different interest rates in cells C3, C4, and C5.
3. Enter the second list in the same row as the formula, to its right.
Type the loan terms (in months) in cells D2 and E2.
4. Select the range of cells that contains the formula (C2), both the row and column of values
(C3:C5 and D2:E2), and the cells in which you want the calculated values (D3:E5).
In this case, select the range C2:E5.
5. On the Data tab, in the Data Tools group, click What-If Analysis, and then click Data Table.
6. In the Row input cell box, enter the reference to the input cell for the input values in the row.
Type cell B4 in the Row input cell box.
7. In the Column input cell box, enter the reference to the input cell for the input values in the
column.
Type B3 in the Column input cell box.
8. Click OK.
Example A two-variable data table can show how different combinations of interest rates and
loan terms will affect a monthly mortgage payment. In the following illustration, cell C2 contains
the payment formula, =PMT(B3/12,B4,-B5), which uses two input cells, B3 and B4.

Suppose you want to view multiple possibilities within an Excel calculation. The answer is to create a
data table.
A data table is a range that evaluates changing variables in a single formula. In other words, it's a simple
what-if analysis: how does changing an input value change the results? You can examine the possibilities
with a quick glance. (A data table isn't the same thing as the new table feature on the Insert tab.)
To illustrate their use, we'll add one to the simple mortgage calculator shown below. As is, you can
change any of the input values to change the results. (It's generally a good practice to separate input
and result cells.) We won't spend any time on building the calculator. You can download the demo
workbook or refer to Table A for the formulas. The IFERROR() function isn't necessary, but consider
using it if you plan to distribute the workbook to others. This function is new to Excel 2007; Excel 2003
users can use ISERROR() to inhibit errors.

Table A: Calculator formulas
Cell Formula Format
B4:B5

Currency
B6

General
B7

Percentage
E4 =B4-B5 Currency
E5 =IFERROR(PMT(B7/12, B6*12,-B4--B5),0) Currency
E6 =IFERROR(E5*B6*12,0) Currency
E7 =IFERROR(E6-E4,0) Currency
Now, let's suppose you want to compare changing interest rates - that's where a data table comes in.
First, enter the data table's labels. They should be easy to glean from the result cells in your original
sheet. In addition, the data table's first column should contain your variable. In this case, that's the
changing interest rate. I used AutoFill to create this list. If you use formulas in the data table's first
column, be sure to paste with values - data tables can't use formulas in the first column.

Now you're ready to enter the data table's references as follows:
1. Select B11, and enter =E5 (the cell that contains the monthly payment formula in the result cell
2. Select C11 and enter =E6.
3. Select D11 and enter =E7.

You're ready to create the data table, but there's one last step. The variable input cell - in this case,
that's the interest rate value - must equal the first value in your data table. The first interest rate in the
data table is 2.5%. You must change the input value in B7 to 2.5% before you generate the data table. Do
not skip this step.

To generate the data table, do the following:
1. Select the data table range. In this case, that's A11:D30.
2. Click the Data tab. In Excel 2003, choose Table from the Data menu and skip to step 4.
3. Choose Data table from the What-If Analysis option in the Data Tools group.
4. In the resulting dialog box, enter the input cell, B7, in the Column Input Cell (because the
interest rate values are in a column, versus a row). This is the input value Excel will change for
each row in the data table.
5. Click OK and format the rest of the table as necessary.

The resulting data table shows how the monthly payment and other values change as the interest rate
changes. By combining the original calculator with a data table, you have the best of both worlds. You
can still use the calculator portion to change all of the input values and the data table will reflect the
changing values with the fixed set of interest ranges (2.5% to 12%) for each mortgage scenario.
Once the data table is in place, you can't change any of the referencing cells (columns B, C, and D in this
data table). Excel protects those cells. In addition, the data table formulas are a series of =TABLE()
functions - this function is just for show. You can't use it in any other context.
Here is an example:

Lets say that we wish to purchase a new tractor for work on our family farm. We need to know
that if interest rates fluctuate we can still afford to pay for the tractor. So we need to know what
our loan repayments will be, what our total repayments will be and how much interest we are
paying.
1. Open the attached workbook on the Base Model worksheet. The highlighted cells
contain formulas.
2. Now click on the Worksheet tab named OneVariable Table and notice that this has
exactly the same data as the previous table, plus an additional area already set up for the
Data Table.
3. Click in cell E3 and type in =B11, which is the Monthly Loan Repayment
4. Click in F3 and type in =B13 which is the Total Repayment.
5. Click in G3 and type in =B14 which is the Total Amount of Interest Paid.
6. Highlight the range of the table D3:G9, click Data>Table
7. Leave the first box, Row input cell, blank. Nothing is required for a one-variable table
8. Click in Column input cell, click on the collapse dialog button and select cell B5 which
contains the original interest rate of 8.97%
9. Collapse back through to your Table dialog box and select OK.
You should now see the results of the calculations given the values entered in D4:D9 that would
appear in cells B11, B13, and B14 of your base model pasted into the table.

Two-variable Data Tables
You can use a two-variable Data Table to gauge the effect on one formula by changing the
value of two input cells within the one table. With this type of table, you can nominate two
series of data that can be placed back into the original model into two different input cells.
Using the example above, this means that you could nominate a series of interest rates to place in
the original interest rate cell (B5) and a series of loan terms to place in the Term of Loan cell
(B7). When creating a two-variable table, one series is entered into the first column of the table
and the other into the first row of the table. As when creating a one-variable table, the formula
reference that we want to test needs to be placed into the blank cell at the top of the first column
of the table. The attached workbook shows an example of a Two-variable Data Table.
Rules
A couple of rules for Data Tables:
1. Set up a "base model"
2. Do not change the values in the "base model"
3. It is a good idea to document the area around your data table, so you and other users can
tell what it is you are analysing.
4. You can use Data Tables to change up to two variables only
5. You can create as many one-variable or two-variable Data Tables as you like in a
Workbook.