To set up Solver in Excel for Microsoft 365 on Windows, enable the Solver Add-in from File > Options > Add-ins, then open Data > Solver. Create a worksheet with a formula to optimize, changing cells, and any limits; enter those references in Solver and choose a solving method. Solver then searches for values that meet your limits and improve the result.
What You’ll Need
- Excel for Microsoft 365 desktop on Windows. Solver is not available in Excel for the web; open the workbook in the desktop app to use it.
- A worksheet model: input data, cells for the values Solver may change, a formula for the outcome to maximize or minimize, and formulas for any limits.
- A clear goal and constraints, such as maximizing profit while staying within a labor or budget limit.
You do not need to write code. The example below uses a small product-mix model so you can see how worksheet cells map to Solver settings. You can adapt the layout to budgets, schedules, production plans, or other optimization problems.
Step-by-Step
- Enable the Solver Add-in. In Excel for Windows, choose File > Options > Add-ins. At the bottom beside Manage, select Excel Add-ins, then click Go. Check Solver Add-in and click OK. If Excel asks to install the add-in, approve the prompt. When it is enabled, Solver appears on the Data tab, usually in the Analysis group. If it is already checked but missing, close and reopen Excel, then check the Data tab again.
- Prepare a model with separate decision cells. Make a worksheet area for your inputs, a separate area for the values Solver can change, and formula cells for the outcome and resource use. For a product-mix example, enter these headings and values: A1 Product, B1 Product A, C1 Product B; A2 Units to make, with B2 and C2 initially set to 0; A3 Profit per unit, with B3 = 30 and C3 = 50; A4 Labor hours per unit, with B4 = 2 and C4 = 4; A5 Material units per product, with B5 = 3 and C5 = 2. Put Total profit in A7, Labor used in A8, and Material used in A9. Place the total labor capacity, 100, in D8 and the material capacity, 90, in D9. These inputs represent the problem; do not put formulas in the changing cells B2:C2.
- Enter formulas for the objective and constraints. With product quantities in B2:C2 and per-unit profits in B3:C3, enter
=SUMPRODUCT(B2:C2,B3:C3)in B7 to calculate total profit. With quantities in B2:C2 and labor hours per unit in B4:C4, enter=SUMPRODUCT(B2:C2,B4:C4)in B8 to calculate labor used. With quantities in B2:C2 and material use per unit in B5:C5, enter=SUMPRODUCT(B2:C2,B5:C5)in B9 to calculate material used. SUMPRODUCT multiplies each quantity by its corresponding per-unit value, then adds the products. With both changing cells at zero, all three results should be zero. - Open Solver and identify the target. Choose Data > Solver. In Set Objective, select B7, the total-profit formula. Choose Max because the goal is to earn as much profit as possible. For a cost-reduction model, you would generally choose Min; for a target value, choose Value Of and enter the desired number. The objective must be a formula that depends, directly or indirectly, on the cells Solver will change.
- Choose the changing cells. In By Changing Variable Cells, select B2:C2. These are the quantities Solver is allowed to adjust. Keep input data such as per-unit profit and capacity outside this range so Solver cannot alter the assumptions to make the result look better. You can select more than one range by separating references with commas, but related decision cells are usually easiest to manage when grouped together.
- Add the resource limits. Click Add in the Constraints area. Set B8 to be less than or equal to D8, then click Add again and set B9 to be less than or equal to D9. In the example, these mean labor used cannot exceed 100 hours and material used cannot exceed 90 units. Add B2:C2 >= 0 as another constraint so Solver cannot recommend negative production. Click OK when the constraints are entered. Use the cell reference fields or select cells directly on the worksheet to avoid typing the wrong address.
- Select a solving method. Choose Simplex LP for a linear model: formulas and constraints must have linear relationships to the changing cells. The product-mix example is linear, so Simplex LP is appropriate. Choose GRG Nonlinear when the model has smooth nonlinear formulas, such as a changing cell multiplied by itself. Choose Evolutionary for models with discontinuities, IF-driven choices, or other relationships that the other methods cannot handle well. Evolutionary can take longer and may not find the best possible answer, so use it when the model requires it rather than as the default.
- Run Solver and review the result. Click Solve and wait for the Solver Results dialog. If Solver reports a solution, choose Keep Solver Solution to retain the values in B2:C2, then click OK. For the example, the optimal quantities are 20 of Product A and 15 of Product B: profit is 20 × 30 + 15 × 50 = 1,350; labor use is 20 × 2 + 15 × 4 = 100; material use is 20 × 3 + 15 × 2 = 90. Both capacities are fully used. If you choose Restore Original Values, Solver will discard the proposed decision-cell values. You can also save a Solver scenario from the results dialog if you want to compare solutions later.
For a different model, the setup follows the same pattern: the objective is the result to improve, the changing cells are the choices, and each constraint is a formula compared with a limit. For example, a budget model might minimize total cost while constraining the selected quantities to meet minimum requirements. Make sure each formula updates when the changing cells change; otherwise Solver has nothing meaningful to optimize.
Common Mistakes
- Setting the objective to a fixed number. Solver needs an objective formula linked to the changing cells. If the target does not change when those cells change, check the references and formula.
- Choosing the wrong variable range. Including input assumptions in the changing range lets Solver alter the data instead of just the decisions. Select only the cells representing choices.
- Leaving out a real-world limit. Without a capacity, budget, minimum, or nonnegative constraint, Solver may return a mathematically valid but unusable answer.
- Using a method that does not fit the model. Simplex LP is for linear models; it is not the right choice if the objective or constraints include nonlinear relationships.
- Expecting whole numbers automatically. Solver can return fractional quantities unless you explicitly add an integer or binary constraint where appropriate.
Tips
- Label decision cells, formulas, and limits clearly. A well-organized model makes it easier to verify Solver’s references and explain the result to someone else.
- Start with a feasible model. Before solving, check whether your limits can all be satisfied at once. For example, a required minimum may conflict with a capacity maximum.
- Use realistic starting values. For a nonlinear model, reasonable initial values can help Solver find a useful solution. For a linear model, the starting values are generally less important.
- Keep a copy of the original inputs or save a separate workbook before experimenting. Solver changes the values in the decision cells when you keep its solution.
- After solving, test the result by checking the objective and every constraint on the worksheet. Solver’s answer is only as sound as the formulas and assumptions you supplied.
Troubleshooting
Solver is missing from the Data tab: Enable Solver Add-in through File > Options > Add-ins, then Manage: Excel Add-ins > Go. If it is enabled and still absent, restart Excel. On Excel for Mac, use Tools > Excel Add-ins, select Solver Add-in, and click OK; ribbon placement may vary by version. Excel for the web does not run the desktop Solver Add-in, so open the workbook in Excel for Windows or Mac.
Solver says it cannot find a feasible solution: Review every constraint for incorrect cell references or reversed signs. Check whether the limits conflict, and inspect starting values and formulas for errors such as #VALUE! or #DIV/0!. Temporarily remove one constraint at a time to find which condition makes the model impossible, then restore it with the corrected reference or limit.
The result looks wrong or does not change: Confirm that the objective and constraint formulas refer to the changing cells, and that the changing-cell range is correct. Recalculate the workbook and check that calculation is not set to Manual under Formulas > Calculation Options. For a linear model, select Simplex LP; for a nonlinear model, try GRG Nonlinear or Evolutionary as appropriate. Also check whether you accidentally selected Restore Original Values instead of keeping the solution.
The answer contains fractions: If the decisions must be whole units, add an integer constraint to the relevant changing cells using the relation list in Add Constraint. Use a binary constraint only when each decision must be 0 or 1. Integer restrictions can make solving more demanding, so keep the model as small and clear as practical.
Frequently Asked Questions
Is Solver included with Excel?
Solver is provided as an Excel Add-in, but it may not be enabled by default. Turn it on through Excel Add-ins in the desktop app. If your organization manages Office installations, you may need an administrator to enable or install it.
Can I use Solver in Excel for the web?
No. The Excel for the web app does not provide the desktop Solver Add-in. Open the workbook in Excel for Microsoft 365 on Windows or in the Excel desktop app for Mac to set up and run Solver.
Which Solver method should I choose?
Use Simplex LP for linear objectives and constraints, GRG Nonlinear for smooth nonlinear models, and Evolutionary for models with discontinuities or difficult non-smooth relationships. If you are unsure, inspect the formulas: multiplying decision cells together or using nonlinear functions can mean the model is not linear.
How do I make Solver return whole numbers?
In the Solver Parameters window, click Add, select the decision-cell range, and choose int in the constraint relation list. Use this only for decisions that must be integer counts; otherwise, fractional values may be valid and easier to solve.
Can Solver maximize profit and obey several limits at once?
Yes. Set the profit formula as the objective and add each limit as its own constraint, such as labor used less than or equal to available hours and material used less than or equal to stock. Solver evaluates them together when searching for a solution.
Related
- Excel New Blank Workbook: Create, Save, and Set It Up
- Excel New Note Shortcut: Add and Edit Notes Quickly
- Date Excel Shortcut: Insert Today’s Date
Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.
More in How-to basics
- Excel Circular Reference Warning: Causes and FixesAn Excel circular reference warning means a formula refers to its own cell, either directly or through a…
- Excel Day of Year: Find the Day Number for Any DateTo find the day of the year in Excel, put a real Excel date in A2 and enter…
- Excel File Opens to a Blank Gray Screen? FixesIf an Excel file opens to a blank gray screen, first check whether the workbook is hidden or…
- Insert Row in Excel: Keyboard Shortcut for WindowsTo insert a worksheet row in Excel for Microsoft 365 on Windows, select the row where the new…
- Combine Cells in Excel on a New Line with CHAR(10)To combine values from A2 and B2 in one cell with a line break between them, enter =A2&CHAR(10)&B2…
- Excel Columns Keep Collapsing? Causes and FixesIf Excel columns keep collapsing, they are usually hidden or grouped into an outline—not deleted. On Windows, select…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.