Вы находитесь на странице: 1из 9

*

CHAPTER 32: USING GOAL SEEK AND SOLVER

slight bug fix: July 12, 2003

Chapter contents
Introduction..................................................................................................................................... 1

32.1. Installing Solver .................................................................................................................... 2

32.2. Using Goal Seek and Solver: a simple example .................................................................. 4

32.3. What’s the difference between Solver and Goal Seek? ........................................................ 7

EXERCISES ................................................................................................................................... 9

Introduction

Goal Seek and Solver are Excel tools that to produce targeted results from your models

(the technical jargon is “calibrate your model”). If this sentence sounds a bit dense, read on—

you’ll see that these tools are extremely useful.

Although Solver is a much more sophisticated tool than Goal Seek, we won’t use many

of its more advanced capabilities. For our purposes, Goal Seek and Solver are thus largely

interchangeable—they can both do most of the financial tasks that we require, and they are not

*
Notice: This is a preliminary draft of a chapter of Principles of Finance with Excel by Simon Benninga

(benninga@wharton.upenn.edu). Check with the author before distributing this draft (though you will probably get

permission). Make sure the material is updated before distributing it. All the material is copyright and the rights

belong to the author.

PFE Chapter 32, Goal Seek and Solver page 1


difficult to use. When you get used to them, you’ll probably find that Solver is preferable,

because it “remembers” its arguments (at this stage you won’t understand this, but read on).

32.1. Installing Solver

Both of these tools come with the standard Excel package, but Solver has to be installed.

If it is not on your computer, do the following:

Open Excel and go to Tools|AddIns:

PFE Chapter 32, Goal Seek and Solver page 2


After clicking AddIns, you’ll get a drop-down menu; scroll down to Solver Add-in and click the

box. That should do it.

PFE Chapter 32, Goal Seek and Solver page 3


32.2. Using Goal Seek and Solver: a simple example

We’ll start with a high-school algebra example: Suppose we’re trying to graph the

equation y = x3 + 2 x 2 − 3 x + 121 . We can do this in Excel as follows:

A B C D E F G
1 SIMPLE EXAMPLE
2 x 5.166147 Table
3 y 21.00001 <-- =-B2^3+2*B2^2-3*B2+121 x y
4 -9 1039 <-- =-E4^3+2*E4^2-3*E4+121
5 -8 785 <-- =-E5^3+2*E5^2-3*E5+121
6 1500 -7 583 <-- =-E6^3+2*E6^2-3*E6+121
7 -6 427 <-- =-E7^3+2*E7^2-3*E7+121
8 1000 -5 311
9 -4 229
10 -3 175
11 500 -2 143
12 -1 127
13 0 121
0
14 -10 -5 0 5 10 15
1 119
15 2 115
16 -500 3 103
17 4 77
18 5 31
-1000
19 6 -41
20 7 -145
21 -1500 8 -287
22 9 -473
23 10 -709
24 11 -1001

PFE Chapter 32, Goal Seek and Solver page 4


Notice that we’ve put the function in twice: In cells B2:B3, we’ve got a simple example

of the function (one value of x and its corresponding y value); in the table to the right, we’ve got

the table for the graph (many values of x and many values of y).

Now we want to find the x such that the corresponding y is 21. You can tell from the

table that the value will be somewhere between 5 and 6. To solve for it, we go to the Excel

command Tools|Goal Seek. This brings up a dialogue box, which we fill in as below:

Hitting the OK box indicates that the answer is approximately 5.150067:

Hitting OK again, accepts this answer:

A B C
1 SIMPLE EXAMPLE
2 x 5.166147
3 y 21.00001 <-- =-B2^3+2*B2^2-3*B2+121

PFE Chapter 32, Goal Seek and Solver page 5


Doing the same thing with Solver

We can do the same calculation with Solver. On the same spreadsheet, we go to the

command Tools|Solver. This brings up a dialogue box which we fill in as follows (note that we

changed the question a bit—this time we’re asking for the x value which gives a y = -58):

Hitting Solve gives the answer:

Hitting OK accepts the answer.

PFE Chapter 32, Goal Seek and Solver page 6


32.3. What’s the difference between Solver and Goal Seek?

Solver and Goal Seek serve much the same purpose. Nevertheless, there are several

differences between them.

Solver remembers, Goal Seek forgets

Suppose you’ve got another question: For which x will y=158? If you use Goal Seek to

answer this question, you’ll have to re-enter all the values into the dialogue box. But if you use

Solver, you’ll see that it comes up with the previous set of values—you only have to change the

entry into the Value of box:

This “memory” of Solver carries over even if you save the file and reopen it later.

PFE Chapter 32, Goal Seek and Solver page 7


Solver is more flexible

Again we use an algebra example, but this time we use the function y = x 2 − 7 x − 14 .

This function is a simple parabola:

A B C D E F
1 SECOND EXAMPLE
2 x 5 Table
3 y -24 <-- =B2^2-7*B2-14 x y
4 -9 130
5 -8 106
6 140 -7 84
7 -6 64
8 120 -5 46
9 -4 30
100
10 -3 16
11 80 -2 4
12 -1 -6
13 60 0 -14
14 1 -20
40
15 2 -24
16 20 3 -26
17 4 -26
18 0 5 -24
19 -10 -5 0 5 10 15 6 -20
-20
20 7 -14
21 -40 8 -6
22 9 4
23 10 16
24 11 30

Now suppose we want to find x such that y = 21. As you can see above, there are 2 such

x’s: One is between –3 and –4, and the other is between 10 and 11. If you use Goal Seek, you

cannot specify which x to find.

With Solver, however, you can specify constraints on the variables:

PFE Chapter 32, Goal Seek and Solver page 8


Here we’ve used Add to enter 2 constraints on x. Pressing Solve gives the correct

answer:

A B C
1 SECOND EXAMPLE
2 x 10.37386
3 y 21 <-- =B2^2-7*B2-14

EXERCISES

Using Goal Seek on the function y = x 2 − 7 x − 14 , find x such that y = 21. Which of the 2

values of x does Goal Seek find?

PFE Chapter 32, Goal Seek and Solver page 9