Microsoft Office Online
Sign in to My Office Online (What's this?) | Sign in

 
 
Microsoft Office Excel
Search
Search
 
Check for updates: (c) Microsoft
Office downloads
 
 
 
Warning: You are viewing this page with an unsupported Web browser. This Web site works best with Microsoft Internet Explorer 6.0 or later, Firefox 1.5, or Netscape Navigator 8.0 or later. Learn more about supported browsers.

Email this linkEmail this link Printer-Friendly VersionPrinter-Friendly Version Bookmark and ShareShare
Define and solve a problem by using Solver
 

Solver is part of a suite of commands sometimes called what-if analysis (what-if analysis: A process of changing the values in cells to see how those changes affect the outcome of formulas on the worksheet. For example, varying the interest rate that is used in an amortization table to determine the amount of the payments.) tools. With Solver, you can find an optimal value for a formula (formula: A sequence of values, cell references, names, functions, or operators in a cell that together produce a new value. A formula always begins with an equal sign (=).) 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 (constraints: The limitations placed on a Solver problem. You can apply constraints to adjustable cells, the target cell, or other cells that are directly or indirectly related to the target cell.) 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

Top of Page Top of Page

Define and solve a problem

  1. If the Solver command or the Analysis group is not available, you need to load the Solver Add-in (add-in: A supplemental program that adds custom commands or custom features to Microsoft Office.) program.

    ShowHow 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 (cell reference: The set of coordinates that a cell occupies on a worksheet. For example, the reference of the cell that appears at the intersection of column B and row 3 is B3.) or name (name: A word or string of characters that represents a cell, range of cells, formula, or constant value. Use easy-to-understand names, such as Products, to refer to hard to understand ranges, such as Sales!C20:C30.) for the target cell. The target cell must contain a formula (formula: A sequence of values, cell references, names, functions, or operators in a cell that together produce a new value. A formula always begins with an equal sign (=).).
  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 (constraints: The limitations placed on a Solver problem. You can apply constraints to adjustable cells, the target cell, or other cells that are directly or indirectly related to the target cell.) that you want to apply.

    ShowHow to add, change, or delete a constraint

    ShowAdd 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 (cell reference: The set of coordinates that a cell occupies on a worksheet. For example, the reference of the cell that appears at the intersection of column B and row 3 is B3.) or name (name: A word or string of characters that represents a cell, range of cells, formula, or constant value. Use easy-to-understand names, such as Products, to refer to hard to understand ranges, such as Sales!C20:C30.) 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 (constraints: The limitations placed on a Solver problem. You can apply constraints to adjustable cells, the target cell, or other cells that are directly or indirectly related to the target cell.). 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 (formula: A sequence of values, cell references, names, functions, or operators in a cell that together produce a new value. A formula always begins with an equal sign (=).).
    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.

    ShowChange or delete a constraint

    1. In the Solver Parameters dialog box, under Subject to the Constraints, click the constraint (constraints: The limitations placed on a Solver problem. You can apply constraints to adjustable cells, the target cell, or other cells that are directly or indirectly related to the target cell.) 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.

Top of Page Top of Page

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.

Top of Page Top of Page

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:

    ShowSolution 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.

    ShowDegree of precision

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

    ShowInteger tolerance

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

    ShowDegree 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.

Top of Page Top of Page

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.
  4.  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.

Top of Page Top of Page

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.

Top of Page Top of Page

advertisement