Solver is part of a suite of commands sometimes called what-if analysis tools. With Solver, you can find an optimal value for a formula in one cell - called the target cell - on a worksheet. Solver works with a group of cells that are related, either directly or indirectly, to the formula in the target cell. Solver adjusts the values in the changing cells that you specify - called the adjustable cells - to produce the result that you specify from the target cell formula. You can apply constraints to restrict the values that Solver can use in the model, and the constraints can refer to other cells that affect the target cell formula.In this article



Overview

Use Solver to determine the maximum or minimum value of one cell by changing other cells. For example, you can change the amount of your projected advertising budget and see the effect on your projected profit amount.

Example of a Solver evaluation

In the following example, the level of advertising in each quarter affects the number of units sold, indirectly determining the amount of sales revenue, the associated expenses, and the profit. Solver can change the quarterly budgets for advertising (cells B5:C5), up to a total budget constraint of $20,000 (cell F5), until the value for the total profit reaches the maximum possible amount. The values in the adjustable cells are used to calculate the profit for each quarter, so the values are related to the formula in the target cell F7, =SUM(Q1 Profit:Q2 Profit).


before solver evaluation

callout 1 Adjustable cells

callout 2 Constrained cell

callout 3 Target cell


After Solver runs, the new values are as follows.

after solver evaluation

Define and solve a problem

  1. On the Data tab, in the Analysis group, click Solver.

    If the Solver command or the Analysis group is not available, you need to load the Solver Add-in program.

    How to load the Solver Add-in program

    1. Click the Microsoft Office Button button image, click Excel Options, and then click the Add-ins category.
    2. In the Manage box, click Excel Add-ins, and then click Go.
    3. In the Add-ins available box, select the Solver Add-in check box, and then click OK.
  2. In the Set Target Cell box, enter a cell reference or name for the target cell. The target cell must contain a formula .
  3. Do one of the following:
    • If you want the value of the target cell to be as large as possible, click Max.
    • If you want the value of the target cell to be as small as possible, click Min.
    • If you want the target cell to be a certain value, click Value of, and then type the value in the box.
  4. In the By Changing Cells box, enter a name or reference for each adjustable cell. Separate the 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.
  5. If you want Solver to automatically propose the adjustable cells based on the target cell, click Guess.
  6. In the Subject to the Constraints box, enter any constraints that you want to apply.

    How to add, change, or delete a constraint

    Add a constraint

    1. In the Solver Parameters dialog box, under Subject to the Constraints, click Add.
    2. In the Cell Reference box, enter the cell reference or name of the cell range for which you want to constrain the value.
    3. Click the relationship ( <=, =, >=, int, or bin ) that you want between the referenced cell and the constraint . If you click int, integer appears in the Constraint box. If you click bin, binary appears in the Constraint box.
    4. In the Constraint box, type a number, a cell reference or name, or a formula .
    5. Do one of the following:
      • To accept the constraint and add another, click Add.
      • To accept the constraint and return to the Solver Parameters dialog box, click OK.

    Notes:

    • You can apply the int and bin relationships only in constraints on adjustable cells.
    • When the Assume Linear Model check box in the Solver Options dialog box is selected, there is no limit on the number of constraints. For nonlinear problems, each adjustable cell can have up to 100 constraints, in addition to bounds and integer restrictions on the variables.

    Change or delete a constraint

    1. In the Solver Parameters dialog box, under Subject to the Constraints, click the constraint that you want to change or delete.
    2. Click Change and then make your changes, or click Delete.
  7. Click Solve and do one of the following:
    • To keep the solution values on the worksheet, click Keep Solver Solution in the Solver Results dialog box.
    • To restore the original data, click Restore Original Values.

    Notes:

    • You can interrupt the solution process by pressing ESC. Microsoft Office Excel recalculates the worksheet with the last values that are found for the adjustable cells.
    • To create a report that is based on your solution after Solver finds a solution, you can click a report type in the Reports box and then click OK. The report is created on a new worksheet in your workbook. If Solver doesn't find a solution, the option to create a report is unavailable.
    • To save your adjusting cell values as a scenario that you can display later, click Save Scenario in the Solver Results dialog box, and then type a name for the scenario in the Scenario Name box.

Step through Solver trial solutions

  1. After you define a problem, click Options in the Solver Parameters dialog box.
  2. In the Solver Options dialog box, select the Show Iteration Results check box to see the values of each trial solution, and then click OK.
  3. In the Solver Parameters dialog box, click Solve.
  4. In the Show Trial Solution dialog box, do one of the following:
    • To stop the solution process and display the Solver Results dialog box, click Stop.
    • To continue the solution process and display the next trial solution, click Continue.

Change how Solver finds solutions

  1. In the Solver Parameters dialog box, click Options.
  2. In the Solver Options dialog box, choose one or more of the following options:

    Solution time and iterations

    1. In the Max Time box, type the number of seconds that you want to allow for the solution time.
    2. In the Iterations box, type the maximum number of iterations that you want to allow.

    Note If the solution process reaches the maximum time or number of iterations before Solver finds a solution, Solver displays the Show Trial Solution dialog box.

    Degree of precision

    • In the Precision box, type the degree of precision that you want. The smaller the number, the higher the precision.

    Integer tolerance

    • In the Tolerance box, type the percentage of error that you want to allow in the solution.

    Degree of convergence

    • In the Convergence box, type the amount of relative change that you want to allow in the last five iterations before Solver stops with a solution. The smaller the number, the less relative change is allowed.

    Note You can click the Help button in the dialog box to get more information about other options.

  3. Click OK.
  4. In the Solver Parameters dialog box, click Solve or Close.

Save or load a problem model

  1. Click Options.
  2. Click Save Model or Load Model.
  3. When you save a model, enter the reference for the first cell of a vertical range of empty cells in which you want to place the problem model. When you load a model, enter the reference for the entire range of cells that contains the problem model.

    Tip You can save the last selections in the Solver Parameters dialog box with a worksheet by clicking the Microsoft Office Button button image, and then by clicking Save. You can also define more than one problem for a worksheet by clicking Save Model to save problems individually.

Algorithms and methods used by Solver

The Microsoft Office Excel Solver tool uses the Generalized Reduced Gradient (GRG2) nonlinear optimization code, which was developed by Leon Lasdon, University of Texas at Austin, and Alan Waren, Cleveland State University.

Linear and integer problems use the simplex method with bounds on the variables and the branch-and-bound method, implemented by John Watson and Daniel Fylstra, Frontline Systems, Inc. For more information about the internal solution process that is used by Solver, contact:

Frontline Systems, Inc.
P.O. Box 4288
Incline Village, NV 89450-4288
(775) 831-0300
Web site: http://www.solver.com
E-mail: info@solver.com

Portions of the Microsoft Office Excel Solver program code are copyright 1990, 1991, 1992, and 1995 by Frontline Systems, Inc. Portions are copyright 1989 by Optimal Methods, Inc.