# 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 (maximum or minimum) 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 objective cell — subject to constraints, or limits, on the values of other formula cells on a worksheet. Solver works with a group of cells, called decision variables or simply variable cells, that participate in computing the formulas in the objective and constraint cells. Solver adjusts the values in the decision variable cells to satisfy the limits on constraint cells and produce the result you want for the objective cell.

**Note** Earlier versions of Solver referred to the objective cell as the "target cell," and the decision variable cells as "changing cells" or "adjustable cells."

- Overview
- Define and solve a problem
- Step through Solver trial solutions
- Change how Solver finds solutions
- Save or load a problem model
- Solving methods used by Solver
- More help on using Solver

## 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 (decision variable cells B5:C5), up to a total budget constraint of $20,000 (cell F5), until the total profit (objective cell F7) reaches the maximum possible amount. The values in the variable cells are used to calculate the profit for each quarter, so they are related to the formula objective cell F7, =SUM(Q1 Profit:Q2 Profit).

After Solver runs, the new values are as follows.

## Define and solve a problem

- 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 (add-in: A supplemental program that adds custom commands or custom features to Microsoft Office.) program.

How to load the Solver Add-in program

- Click the
**File**tab, click**Options**, and then click the**Add-Ins**category. - In the
**Manage**box, click**Excel Add-ins**, and then click**Go**. - In the
**Add-ins available**box, select the**Solver Add-in**check box, and then click**OK**.

- In the
**Set Objective**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 objective cell. The objective cell must contain a formula. - Do one of the following:

- If you want the value of the objective cell to be as large as possible, click
**Max**. - If you want the value of the objective cell to be as small as possible, click
**Min**. - If you want the objective cell to be a certain value, click
**Value of**, and then type the value in the box.

- In the
**By Changing Variable Cells**box, enter a name or reference for each decision variable cell range. Separate the nonadjacent references with commas. The variable cells must be related directly or indirectly to the objective cell. You can specify up to 200 variable cells. - In the
**Subject to the Constraints**box, enter any constraints that you want to apply by doing the following:

- In the
**Solver Parameters**dialog box, click**Add**. - In the
**Cell Reference**box, enter the cell reference or name of the cell range for which you want to constrain the value. - Click the relationship (
**<=**,**=**,**>=**,**int**,**bin**, or**dif**) 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. If you click **dif**, **alldifferent** appears in the **Constraint** box.

- If you choose <=, =, or >= for the relationship in the
**Constraint**box, type a number, a cell reference or name, or a formula. - 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**.

**Note** You can apply the **int**, **bin**, and **dif** relationships only in constraints on decision variable cells.

You can change or delete an existing constraint by doing the following:

- In the
**Solver Parameters**dialog box, click the constraint that you want to change or delete. - Click
**Change**and then make your changes, or click**Delete**.

- Click
**Solve**and do one of the following:

- To keep the solution values on the worksheet, in the
**Solver Results**dialog box, click**Keep Solver Solution**. - To restore the original values before you clicked
**Solve**, click**Restore Original Values**.

**Notes**

- You can interrupt the solution process by pressing ESC. Microsoft Excel recalculates the worksheet with the last values that are found for the decision variable 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, only certain reports or no reports are available. - To save your decision variable 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

- After you define a problem, click
**Options**in the**Solver Parameters**dialog box. - In the
**Options**dialog box, select the**Show Iteration Results**check box to see the values of each trial solution, and then click**OK**. - In the
**Solver Parameters**dialog box, click**Solve**. - 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

- In the
**Solver Parameters**dialog box, click**Options**. - Choose or enter values for any of the options on the
**All Methods**,**GRG Nonlinear**, and**Evolutionary**tabs in the dialog box.

## Save or load a problem model

- In the Solver Parameters dialog box, click
**Load/Save**. - Enter a cell range for the model area, and click either
**Save**or**Load**.

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 saving the workbook. Each worksheet in a workbook may have its own Solver selections, and all of them are saved. You can also define more than one problem for a worksheet by clicking **Load/Save** to save problems individually.

## Solving methods used by Solver

You can choose any of the following three algorithms or solving methods in the **Solver Parameters** dialog box:

**Generalized Reduced Gradient (GRG) Nonlinear**Use for problems that are smooth nonlinear.**LP Simplex**Use for problems that are linear.**Evolutionary**Use for problems that are non-smooth.

For more information about these methods, 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 Solver program code are copyright 1990-2009 by Frontline Systems, Inc. Portions are copyright 1989 by Optimal Methods, Inc.

## More help on using Solver

For more detailed help on Solver from Frontline Systems, visit Solver Help at www.solver.com.