What-If Analysis: How to Create One and Two Variable Data Tables in Excel
(Note: Suitable for users of Excel 2016, 2019, 2021, and Excel for Microsoft 365.)
Objective
Use one-variable and two-variable data tables in Excel to vary the interest rate and term length for a loan, to evaluate potential monthly payment amounts.
Data Tables in Excel Explained
Data tables are part of a suite of utilities known as What-if Analysis tools in Excel. What-if Analysis is the process of changing values in cells to see how those changes affect the outcome. There are three types of What-If Analysis tool in Excel: Scenarios, Goal Seek and Data Tables.
Data tables in Excel employ the PMT function to help us calculate monthly payments on a loan using varying interest rates and loan amounts.
For example, we might want to take out a loan for a mortgage with the bank and see if that loan is affordable by analyzing the monthly payments at different interest rates and different loan amounts.
There are two different types of data table: one-variable or two-variable. A one-variable data table allows us to analyze our data using one-variable e.g., differing loan amounts. A two-variable data table allows us to analyze our data using two-variables e.g., differing loan amounts and a variable interest rate. Analyzing our data in this way can in turn help us make better decisions when determining the affordability of a loan.
- Example
- Calculating Monthly Payments with PMT
- Creating a One-Variable Data Table
- Creating a Two-Variable Data Table
Related reads:
How to Split and Combine Data in Excel
Example
In our example, we are going to calculate the monthly payments on $300,000 mortgage, over a period of 25 years. We will create a one-variable data table to analyze the monthly payments over differing interest rates and a two-variable data table to analyze the monthly payments over different interest rates and differing loan amounts. The balance of the loan will be paid down to zero and we will make our payments at the end of the month.
It’s recommended to list out this information in a table at the top of the worksheet.
The first thing we need to do is work out the monthly payment based on the data in the table, using the PMT function. This calculation will then form the basis of our data table.
Calculating Monthly Payments with PMT
The PMT function stands for Payment. It is part of Excel’s Financial functions group. PMT will calculate the monthly payments on a loan.
The PMT function has 5 arguments. The last two arguments are optional.
rate | The monthly interest rate |
nper | The number of payments (in months) |
pv | The present value of the loan |
fv (optional) | The future value of the loan. Are we paying down to 0 or are we making a balloon payment to clear the balance? |
type (optional) | Are we making our payments at the beginning or the end of the month? |
It’s worth noting that because we are calculating monthly payments, all calculations must represent the monthly value. For example, notice in the table the Interest Rate and the Term are both yearly values. We need to make these monthly.
The rate argument represents the interest rate. As this is a yearly interest rate, we need to divide it by 12 to get the monthly interest rate.
The nper argument represents the number of payments or how many months this loan will be paid back over. Again, this is represented in the table as years so we need to multiple it by 12 to get the number of months.
The pv argument is the present value of the loan. This is the loan amount.
The fv argument is optional. This represents the future value of the loan. Are we paying this loan down to zero or are we paying it down to, for example, $50,000 and then making a bulk payment at the end? We are paying the loan down to zero.
The type argument is optional. This lets us specify if we are making our monthly payment at the beginning of the end of the month. We are paying at the end of the month.
By default, the monthly payment will be negative. Excel sees this money as being deducted from our bank account and so displays it as a negative value. We can keep it like this or we can convert it to a positive value by adding a minus (-) sign to the beginning of the PMT formula.
Our monthly payment on a $300,000 loan, over a period of 25 years at an interest rate of 2.00% is $1,271.56.
We can now use this PMT calculation to create a one-variable data table.
Suggested reads:
How to Calculate Mean in Excel
How to Calculate Correlation Coefficient in Excel
How to Add Sparklines in Excel
Creating a One-Variable Data Table
It would be useful to be able to compare the monthly payments on this loan over varying interest rates. Maybe some banks are offering different interest rates and we want to see which would be the most affordable and exactly how much we would be paying each month.
Let’s create a one-variable data table.
The first thing to do is to list out the different interest rates.
When creating a data table, we need to be able to select all the varying interest rates and the PMT calculation in a rectangular selection. This selection will be easier if we add the PMT formula next to the Interest Rate heading. We can simply link to the cell.
Now, we need to select the interest rates and the PMT calculation.
- From the Data tab, in the Forecast group, click What-if Analysis.
- Choose Data Table from the menu.
As this is a one-variable data table, we only need to complete one input. Our input is the interest rate. The interest rates are listed in the column so we populate the Column input cell with the interest rate from the table.
- Click OK.
We can check this is correct by comparing the data in the table with the data table.
We can hide the PMT calculation in the data table by applying custom formatting.
- Select the cell and press CTRL+1.
- Select Custom from the Category list.
- In the Type field, type ;;; (3 semi-colons).
- Click OK.
Format the table as desired.
Creating a Two-Variable Data Table
A two-variable data table works in a similar way except instead of one input value we have two. It might useful for us to compare the monthly payments on this loan over varying interest rates and varying loan amounts.
- Calculate the PMT in exactly the same way.
This time we need to add headings for the interest rate and the loan amounts. This time we have the interest rate in the row and the loan amounts in the column.
- Link to the PMT calculation.
- Select all of the data including the PMT.
- From the Data tab, in the Forecast group, click What-if Analysis.
- Select Data Table from the menu.
This time we have two inputs so we need to complete the row input cell and the column input cell. We have our interest rates in the row and the loan amounts in the column so we need to select these from the original table.
- Click OK.
We can check this is correct by finding the monthly payment for the $300,000 loan at a rate of 2.00% in the data table. The monthly payment should match.
We can hide the PMT calculation in the data table by applying custom formatting.
- Select the cell and press CTRL+1.
- Select Custom from the Category list.
- In the Type field, type ;;; (3 semi-colons).
- Click OK.
Also read:
Ten Ways to Clean Data in Excel
Please visit our free resources center for more high-quality Excel and Microsoft Suite application guides.
Ready to dive deep into Excel? Click here for advanced Excel courses with in-depth training modules.
Simon Sez IT taught Excel and other business software for over ten years. You can access 150+ IT training courses for a low monthly fee.