Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Power excel 2016 with mrexcel Master Pivot Tables, Subtotals, Charts, VLOOKUP, IF, Data Analysis in Excel 2010–2013 (Bill Jelen) (z-lib.org).pdf
Скачиваний:
4
Добавлен:
14.08.2022
Размер:
49.75 Mб
Скачать

PART 2: CALCULATING WITH EXCEL

127

 

 

Figure 314 Replace the 1, 2, 3 with ROW(A1).

DO 40 WHAT-IF ANALYSES QUICKLY

Problem: I want to buy a car, and I want to compare eight price points and four loan terms to calculate the monthly payment amount.

Strategy: You can solve this problem by using a data table. You set up the worksheet as follows:

1. Build the model shown in A1:B4 below. Cell B4 will become the top left corner cell of your what-if table.

2. In cells B5:B5, enter the four possible terms you would like to compare. In cells C4:L4, enter the possible loan amounts.

3. Select the rectangular range B5:L9. The upper-left corner of this range contains the formula to cal- 2 culate your monthly payment.

Figure 315 Loan terms along the side, loan amounts across the top.

4. Select Data, What-If Analysis, Data Table. Excel will ask you to specify a row input cell. In other words, Excel will take each cell in the top row of the table and substitute it for the row input cell. Because these cells contain prices, choose cell B1 as the row input cell.

5. Next, Excel wants to know where the cells in the first column of your data table should be used. Be- cause B5:B8 contains loan terms, specify cell B3 as the Column Input Cell. Click OK.

Figure 316 Each cell in the top row gets plugged into B1.

Excel will enter an array formula for you, based on the original formula in the top-left cell of the table. It will show you the monthly prices for many combinations of terms and price points.

128

POWER EXCEL WITH MR EXCEL

 

 

Figure 317 The formula is replicated for each cell.

If you are looking for a monthly payment of $425, you will have to either negotiate down to a price of $21,995 with a 60-month loan, $23,995 with a 66-month loan, or choose a 72-month loan.

The formulas in the table are live. You can reenter new values in the first column and row of the table in order to zoom in on possible scenarios.

Additional Details: You can also change the formula in B4, and the table will update.

RANDOM WALK DOWN WALL STREET

The previous example is the classic use of the Data Table function. However, while judging the ModelOff World Financial Championships in New York in 2012, I met professor Simon Benninga and he demonstrated a very different use for data tables.

First, build a column that represents 100 coin flips. If the RAND() is > .5 then you win a penny, otherwise you lose a penny. Add a graph. Every time you press F9, Excel runs the 100 coin flips again and the graph updates.

Figure 318 Simulating 100 coin flips using RAND().

You might be interested in some statistics from these 100 coin flips. What was the highest you were ever ahead? What was the lowest you were ever behind? Where did you finish after 100 coin flips. Set up formu- las going across a row with =MAX(A2:A101), =MIN(A2:A101), and =A101.

Now - say that you want to run the 100 coin flip experiment 1000 times. Select the blank cell to the left of your formulas, the three formulas, and then 1000 blank rows below. Select Data, What-If, Data Table. You will leave the Row Input Cell blank. For the Column Input Cell, choose any blank cell outside of the table.

PART 2: CALCULATING WITH EXCEL

129

 

 

Figure 319 Run the what-if table based on a blank cell.

This is a seemingly bizarre request. You are telling Excel to take the 1000 blank cells in K2:K1001, plug them in to the blank J1 cell, and record the results of the Max, Min, and Final. Since those cells are the results of formulas containing =RAND() or =RANDBETWEEN(), each row in the resulting data table rep- resents the results of 100 coin flips. In all, you’ve effectively modeled 100,000 coin flips.

2

Figure 320 Each row shows the statistics after 100 coin flips.

This technique works because your model is based on one of the random functions.

WHAT-IF FOR 3 OR MORE VARIABLES

Problem: The previous trick is cool, but what if I have three or more variables to change?

Strategy: If you have 3 variables to change, make many copies of the worksheet in the above example and change the third variable in each copy of the table.

If you have 3 or more variables, you can reluctantly use Excel’s Scenario Manager as described in this topic. If your manager has $99 in the budget, you can instead buy the MrExcel.com Monte Carlo Manager to handle multiple variable scenarios easily.

Excel’s Scenario Manager is found in the What-If dropdown of the Data ribbon tab. The tool will let you specify any number of input variables and any number of output variables. For each scenario, you have to type the input variables into a dialog box. The Scenario Manager will then produce a report of all the scenarios.

1. This step is optional, but the output report will be more meaningful if you name all of the input cells and all of the output cells.

2. Select Data, What-If Analysis, Scenario Manager.

3. Click the Add... button in the Scenario Manager dialog.

4. Type a name for the scenario using the current values. Specify the input cells by clicking the first cell and Ctrl+clicking the other input cells. Click OK.

130

POWER EXCEL WITH MR EXCEL

 

 

Figure 321 Specify the input cells.

5. Excel will show you the current input values. These are probably correct for the first scenario.

Figure 322 Verify the values for the original scenario.

6. Click Add. You will go back to the Add Scenario dialog.

7. Enter a new scenario name and description. Click OK. You will go to the Scenario Values dialog.

8. Enter new input variables for this scenario.

9. Repeat steps 6 to 8 for each additional scenario. When you are done entering scenarios, click OK instead of Add in the Scenario Values dialog.

10.In the Scenario Manager dialog, choose any scenario and click Show to show that scenario in the worksheet.

Figure 323 Choose a scenario and click Show.