
You can interrupt the solution process by pressing Esc. To restore the original values before you clicked Solve, click Restore Original Values. To keep the solution values on the worksheet, in the Solver Results dialog box, click Keep Solver Solution. In the Solver Parameters dialog box, click the constraint that you want to change or delete.Ĭlick Change and then make your changes, or click Delete. You can change or delete an existing constraint by doing the following: Note You can apply the int, bin, and dif relationships only in constraints on decision variable cells. To accept the constraint and return to the Solver Parameters dialog box, click OK. To accept the constraint and add another, click Add. If you choose = for the relationship in the Constraint box, type a number, a cell reference or name, or a formula. If you click dif, alldifferent appears in the Constraint box. If you click bin, binary appears in the Constraint box. In the Cell Reference box, enter the cell reference or name of the cell range for which you want to constrain the value.Ĭlick 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. In the Solver Parameters dialog box, click Add. In the Subject to the Constraints box, enter any constraints that you want to apply by doing the following: You can specify up to 200 variable cells. The variable cells must be related directly or indirectly to the objective cell. Separate the non-adjacent references with commas. In the By Changing Variable Cells box, enter a name or reference for each decision variable cell range. If you want the objective cell to be a certain value, click Value of, and then type the value in the box. If you want the value of the objective cell to be as small as possible, click Min. If you want the value of the objective cell to be as large as possible, click Max. The objective cell must contain a formula. In the Set Objective box, enter a cell reference or name for the objective cell. The SolverAdd function is used to add three constraints to the current problem.Note: If the Solver command or the Analysis group is not available, you need to activate the Solver add-in. This example uses the Solver functions to maximize gross profit in a business problem. The right side of the constraint.Īfter constraints are added, you can manipulate them with the SolverChange and SolverDelete functions. If you choose 4, 5 or 6, CellRef must refer to decision variable cells, and FormulaText should not be specified.Ĭells referenced by CellRef must have final values that are integers.Ĭells referenced by CellRef must have final values of either 0 (zero) or 1.Ĭells referenced by CellRef must have final values that are all different and integers.įormulaText Optional Variant. The arithmetic relationship between the left and right sides of the constraint. A reference to a cell or a range of cells that forms the left side of a constraint. SolverAdd( CellRef, Relation, FormulaText)ĬellRef Required Variant.



If Solver.xlam does not appear under Available References, click Browse and open Solver.xlam in the \office14\library\Solver subfolder. In the Visual Basic Editor, with a module active, click References on the Tools menu, and then select the Solver.xlam check box under Available References. Equivalent to clicking Solver in the Data | Analysis group and then clicking Add in the Solver Parameters dialog box.īefore you use this function, you must establish a reference to the Solver add-in. Adds a constraint to the current problem.
