Sub topic 7
Setting up Solver: objective, variables, and constraints
Assume you know Excel cell references, formulas, absolute references, and basic financial concepts such as revenue, cost, profit, and cash flow. This chapter focuses on building a Solver model. It does not cover the different solving methods in detail.
The three parts of a Solver model
Solver finds values for selected cells that improve an objective while obeying constraints. A well-structured model separates the cells that Solver may change from the formulas that calculate results.
| Part | Meaning | Example |
|---|---|---|
| Objective cell | The result to maximize, minimize, or set to a target | Total profit |
| Variable cells | Input cells Solver may change | Units of products X and Y |
| Constraint | A rule that the solution must obey | Machine hours used must be at most 100 |
The objective cell must contain a formula that depends, directly or indirectly, on the variable cells. If the objective does not change when a variable changes, Solver has no useful path to a solution.
Structure the worksheet
Use separate areas for assumptions, decision variables, calculations, and checks. For example, a product-mix model might contain:
- Product X units in
B3 - Product Y units in
C3 - Profit per unit for each product in
B4:C4 - Total profit in
B6 - Machine hours used in
B8 - Total units in
B9
The formulas could be:
B6: =B3*B4+C3*C4
B8: =B3*2+C3*4
B9: =B3+C3Here, B6 is the objective cell. B3:C3 are the variable cells. B8 and B9 calculate resource usage and total output, which Solver can compare with constraints.
Keep decision variables as hardcoded starting values rather than formulas. Solver changes these cells during its search. Put rates, prices, and capacity limits in clearly labeled assumption cells so that another person can audit the model.
Define the objective
In the Solver Parameters window, select the objective cell. Then choose one of these goals:
- Max when the model should maximize profit, return, or value.
- Min when the model should minimize cost, risk, or required funding.
- Value Of when the model should make a formula equal a specified target.
For a product-mix model, choose B6 and select Max. Do not select a component such as product revenue if the real business objective is profit after all relevant costs.
Define the variable cells
The variable cells are the decisions Solver is allowed to change. For the example, select B3:C3. Use a range when several related decisions exist.
The variable cells should be:
- Direct inputs to the model.
- Formatted and labeled clearly.
- Initialized with plausible values.
- Free of accidental formulas or links to the objective.
If products cannot be made in fractional units, add an integer constraint. If a decision is binary, such as whether to accept a project, use a binary constraint. These restrictions turn business meaning into mathematical rules.
Add constraints
A constraint compares a formula or variable with a limit. Common forms include:
B8 <= 100: machine hours cannot exceed available capacity.B9 <= 40: total production cannot exceed demand.B3:C3 >= 0: production cannot be negative.B3:C3 = integer: production must use whole units.
In Solver, choose Add, select the left-hand cell or range, choose the comparison operator, and enter the right-hand cell or value. Prefer references to assumption cells, such as B10, over typing 100 directly. This makes the model easier to update.
Validate the setup
Before running Solver, change one variable manually and confirm that the objective and constraint formulas respond. Check units, signs, and limits. A capacity constraint measured in hours must not be compared with a limit measured in dollars.
Exercise
A model has total profit in B6, product quantities in B3:C3, machine hours in B8, and capacity in B10. What should you enter as the objective, variable cells, and capacity constraint?
Show answer
Set B6 as the objective and choose Max, set B3:C3 as the variable cells, and add B8 <= B10 as the capacity constraint.