Goal Seek and Solver Optimization
Goal Seek and Solver Optimization
CUK
March 2020
GOALSEEK
Allows us to determine an input value that
would be needed to get a given output
Used for a single output and a single input
Allows us to work backwards in a worksheet
Lets you vary only one input variable
What-if analysis in the reverse direction.
• Ex. How much would we have to pay our part-time
workers in $/hr to only spend $26,000 per year?
GOALSEEK
Input to vary
GOALSEEK
Part of Standard Excel Installation
Finds the root of a scalar function
f ( x) = 0
• Recall that root-finding methods (e.g., bisection method,
Newton’s method) rely on a change in sign of the
objective function
• Any f(x) function used in GOALSEEK should have a well
defined sign change
GOALSEEK - EXAMPLE
Use Excel’s GOALSEEK feature to find the root of f(x) = x –
cos(x) between 0 and 1.
0.6
0.4
0.2
0
x - cos(x)
x
GOALSEEK - EXAMPLE
Make use of named ranges in Excel
Create solution variable cell “xval” and target cell “fofx”
Highlight cells that
will be named. Under
Formulas Tab select
Create from Selection
GOALSEEK - EXAMPLE
Input the function into the “target cell”
Use the named variable
f ( x1 , x2 , x3 , , xn ) = 0
max[ f ( x1 , x2 , x3 , , xn )]
min[ f ( x1 , x2 , x3 , , xn )]
SOLVER
Uses a gradient-based method (like Newton’s method) to
find the root or the max/min
Works very well for functions that have a well-defined
minimum (or maximum), like a quadratic form (a parabola)
FINDING THE ADD-INS
IN EXCEL 2000
Go to Excel
Options
FINDING THE ADD-INS IN EXCEL
Go to Add-Ins Tab
on left and click Go
at bottom
FINDING THE ADD-INS IN EXCEL
Make sure
Solver Add-In is
checked and
click ok
FINDING THE SOLVER ADD-IN
Now go to Data
tab and click on
Solver on the
far right
SOLVER - EXAMPLE
Find the minimum of
f(x,y)=(x-5)2 + (y-5)2
50
40
(X-5)2 +(Y-5)2
30
20
10
0
15
10
5 10 12
6 8
0 2 4
Y 0
X
SOLVER - EXAMPLE
Use named ranges to establish variables for ‘xval’ and ‘yval’
Use named range to create a target cell ‘fxy’
EXAMPLE 2: CREATING NAMED RANGES
SOLVER - EXAMPLE
Put initial guesses for xval, yval in their cells (use (0,0))
Type the formula into the target cell (“=(xval-5)^2 + (yval-
5)^2”)
EXAMPLE 2: SETTING UP THE SPREADSHEET
SOLVER - EXAMPLE
Invoke the SOLVER function
MICROSOFT HELP ON “SOLVER”
Define and solve a problem by using Solver
On the Data Tab, click Solver (far right).
If the Solver command is not on the Data Tab, you need to
install the Solver add-in.
In the Set Target Cell box, enter a cell reference or name for
the target cell. The target cell must contain a formula.
EXAMPLE 2: INVOKING THE SOLVER FUNCTION
Solver is found
on far right of
Data tab
MICROSOFT HELP ON “SOLVER”
To have the value of the target cell be as large as
possible, click Max.
To have the value of the target cell be as small as
possible, click Min.
To have the target cell be a certain value, click Value of,
and then type the value in the box.
In the By Changing Cells box, enter a name or reference
for each adjustable cell, separating nonadjacent
references with commas. The adjustable cells must be
related directly or indirectly to the target cell. You can
specify up to 200 adjustable cells.
EXAMPLE 2: THE SOLVER DIALOG BOX
MICROSOFT HELP ON “SOLVER”
To have Solver automatically propose the adjustable
cells based on the target cell, click Guess.
In the Subject to the Constraints box, enter any
constraints you want to apply.
Click Solve.