Using The Solver in Excel 2010: Before You Start
Using The Solver in Excel 2010: Before You Start
Table of Contents
Overview .................................................................................................................. 1
Before you start ................................................................................................... 1
Loading the Solver add-in ........................................................................................ 1
Chocolate Example .................................................................................................. 2
The dilemma! ....................................................................................................... 2
A solution ............................................................................................................. 2
Changing some constraints .................................................................................. 4
Allocation of funds example .................................................................................... 5
Exercise ................................................................................................................ 7
Solution ................................................................................................................ 7
More practice....................................................................................................... 8
Other resources ....................................................................................................... 8
Overview
These notes are an introductory guide to using the Solver add-in for Excel 2010.
Solver is a what-if analysis tool for optimization. You can use the Solver to find
the optimum value for a particular cell by adjusting the values of several cells.
4. The Solver command should now be available from the Analysis group on the
Data tab.
Chocolate Example
This example is an adaptation of a problem at
http://www.reading.ac.uk/web/FILES/its/solver2007.pdf
The dilemma!
A solution
Open the chocolate_solver.xls file. We have set up the spreadsheet to reflect this
basic data. We want to:
maximise the amount of chocolate (cell D12)
only buy whole bars (the shopkeeper probably wont sell us part of a bar)
keep within our $20 budget
Examine the data and the formulae to make sure you understand them. To
establish how to get the most chocolate for your voucher, complete the following
steps:
1. Go to the Data tab and within the Analysis group, choose Solver A Solver
Parameters dialog box appears.
a) For the Set Objective box, click on cell D12.
(Cell D12 calculates the total weight of the chocolate.)
b) Under To: choose Max
(You want to maximise the total weight of the chocolate.)
c) Click into the By Changing Variable Cells box.
i) Click on cell C7.
ii) Drag through to cell C9.
iii) $C$7:$C$9 should appear.
(Cells C7 to C9 represent the various ways you can buy the chocolate.)
Page | 2
d) Click into the Subject to the Constraints box. To enter the constraint that
the total cost must equal $20:
i) Click on Add An Add Constraint dialog box appears.
ii) Under Cell Reference click on cell E12. $E$12 should appear.
iii) Under Constraint select = and click on cell C14. (or we could have typed
in 20.00)
iv) Click on Add
e) To enter the constraint that you cant buy part of a chocolate bar:
i) Under Cell Reference click on cell C7 and drag through to cell C9.
$C$7:$C$9 should appear.
ii) Under Constraint choose int for integer.
(An integer is a whole number.)
iii) Click on Add
f) To enter the constraint that you cant have a negative number of bars:
i) Under Cell Reference click on cell C7 and drag through to cell C9.
$C$7:$C$9 should appear.
ii) Under Constraint choose >= and type in: 0
iii) Click on Add Click on Cancel
2. You should be back in the Solver Parameters dialog box. The settings in the
dialog box should look similar to those in the image below.
Page | 3
4.
5.
6.
7.
Do we really have to use up the total value of the voucher? What happens if we
relax this requirement slightly and amend the constraint so that total cost must be
< or = to $20.
1. Go to the Data tab and within the Analysis group, choose Solver A Solver
Parameters dialog box appears.
To enter the constraint that total cost must be < or = to $20
a) Select the $E$12=$C$14 constraint and click on Change A Change
Constraint dialog box appears.
b) Change the = to <= and click on OK
2. You should be back in the Solver Parameters dialog box. Click on the Solve
button.
3. A Solver Results dialog box appears. In the worksheet, the numbers of each
type of chocolate bar have altered. The total weight is now 1550 grams and we
have spent $19.80. This solution suggests we buy 3 large and 8 small bars to
give us an extra 50 grams of chocolate.
4. Choose Restore Original Values and experiment by changing some of the other
variables.
Page | 4
Page | 5
3. Click on Solve
4. A Solver Results dialog box appears. In the worksheet, the weights of each
stock have altered, and the return has increased to 17.1% for the same risk (i.e.
the variance of 7.1%). For now,
select Restore Original Values and
click on OK
Page | 6
Exercise
Solution
2. You should be back in the Solver Parameters dialog box. Under Subject to
the Constraints:
$E$10:$E$14>=0
$E$16=1
$E$18>=0.164
should all be visible. The dialog box should look similar to the one below.
Page | 7
3. Click on Solve
4. A Solver Results dialog box appears.
In the worksheet, the weights of each
stock have altered, and the risk (i.e. the
variance) has decreased to 6.2% for the
same (original) return of 16.4%. For
now, click on Restore Original Values
and click on OK
More practice
Experiment by changing some of the other variables. For example, what is the
maximum return available for a given level (or less) of risk, if, say, at least 20% of
the portfolio must be invested in Govt stock?
Examine the file SOLVSAMP.XLSit shows lots of uses for the Solver.
Other resources
The following websites are useful:
New and Improved Solver http://blogs.office.com/b/microsoftexcel/archive/2009/09/21/new-and-improved-solver.aspx
Lots of examples at http://www.solver.com/solutions/
Solver help http://www.solver.com/excel2010/solverhelp.htm
Page | 8