# Use variables in a data table to find multiple answers

By plugging different numbers into a cell, you can quickly come up with different answers to a problem. A great example is using the PMT function with different interest rates and loan periods (in months) to figure out how much of a loan you can afford for a home or a car. You enter your numbers into a range of cells called a data table.

Here, the data table is the range of cells B2:D8. You can change the value in B4, the loan amount, and the monthly payments in column D automatically update. Using a 3.75% interest rate, D2 returns a monthly payment of \$1,042.01 using this formula: =PMT(C2/12,\$B\$3,\$B\$4).

You can use one or two variables, depending on the number of variables and formulas you want to test.

Use a one-variable test to see how different values of one variable in a formula will change the results. For example, you can change the interest rate for a monthly mortgage payment by using the PMT function. You enter the variable values (the interest rates) in one column or row, and the outcomes are displayed in a nearby column or row.

In this live workbook, cell D2 contains the payment formula =PMT(C2/12,\$B\$3,\$B\$4). Cell B3 is the variable cell, where you can plug in a different term length (number of monthly payment periods). In cell D2, the PMT function plugs in the interest rate 3.75%/12, 360 months, and a \$225,000 loan, and calculates a \$1,042.01 monthly payment.

Use a two-variable test to see how different values of two variables in a formula will change the results. For example, you can test different combinations of interest rates and number of monthly payment periods to calculate a mortgage payment.

In this live workbook, cell C3 contains the payment formula, =PMT(\$B\$3/12,\$B\$2,B4), which uses two variable cells, B2 and B3. In cell C2, the PMT function plugs in the interest rate 3.875%/12, 360 months, and a \$225,000 loan, and calculates a \$1,058.03 monthly payment.