To put Solver in Excel for Microsoft 365 on Windows, enable the Solver Add-in under File > Options > Add-ins, then select Solver Add-in and click OK. Solver appears on the Data tab and can find the best values for selected cells while meeting the limits you specify. You will need the desktop Excel app and a worksheet with a formula to optimize; Solver is not available to run in Excel for the web.
What You’ll Need
- Excel for Microsoft 365 desktop on Windows, or a compatible desktop version of Excel that includes the Solver Add-in.
- A workbook with an objective formula, such as total profit, cost, or time, plus cells Solver can change.
- Any limits for the problem, written as worksheet values or formulas—for example, a maximum budget or minimum production amount.
You do not need to download a separate Solver program. It is an Excel add-in that may need to be switched on before it appears in the ribbon. The example below uses two products to show how to enable Solver and set up a small linear optimization problem.
Step-by-Step
-
Open the Excel Add-ins settings. Open your workbook, click File, and choose Options. In the Excel Options window, select Add-ins. At the bottom, find the Manage box, choose Excel Add-ins, and click Go. This is the Windows desktop path; do not choose COM Add-ins, because Solver is an Excel add-in rather than a COM add-in.
-
Turn on Solver. In the Add-ins dialog, check Solver Add-in and click OK. If Excel asks whether to install or load the add-in, accept the prompt. After it finishes, open the Data tab and look for Solver, usually in the Analysis group at the right side of the ribbon. If the checkbox is already selected, close the dialog and check the Data tab again.
On a Mac, the menu labels differ: choose Tools > Excel Add-ins, check Solver Add-in, and click OK. Solver is a desktop feature; if you are working in Excel for the web, open the workbook in the desktop app to use it.
-
Make a worksheet model before opening Solver. Enter the following small example. Put the decision quantities for Product A and Product B in B2 and C2, initially entering 0 in both. Enter their unit profits, 40 and 30, in B3 and C3; labor required per unit, 2 and 1, in B4 and C4; and material required per unit, 1 and 2, in B5 and C5. Label column A so the rows are clear. Put the total available labor, 100, in D7 and the total available material, 80, in D8. The values in B2:C2 are the cells Solver will adjust.
With units in B2:C2, unit profits in B3:C3, and the objective label in A6, enter this formula in B6 to calculate total profit:
=SUMPRODUCT(B2:C2,B3:C3). With the same unit quantities in B2:C2 and labor-per-unit values in B4:C4, enter this formula in B7 to calculate labor used:=SUMPRODUCT(B2:C2,B4:C4). With material-per-unit values in B5:C5, enter this formula in B8 to calculate material used:=SUMPRODUCT(B2:C2,B5:C5). Each formula initially returns 0 because both quantities start at 0. These formulas multiply each product’s quantity by its per-unit value and add the results. -
Open Solver and identify the objective. Select Data > Solver. In the Solver Parameters window, set Set Objective to B6, the cell containing total profit. Under To, choose Max because the example aims to earn as much profit as possible. For a cost-minimization problem, you would usually choose Min; choose Value Of only when you need the formula to reach a particular number.
-
Choose the cells Solver can change. In By Changing Variable Cells, enter or select B2:C2. These are the product quantities. Use the worksheet range box or select the cells directly on the sheet. Do not include the formula cells B6:B8 in the changing range: Solver should adjust the inputs and let the formulas recalculate.
-
Add the resource limits. Click Add in the Constraints area. Set the first Cell Reference to B7, choose the less-than-or-equal-to relation, and set Constraint to D7. Click Add again and set B8 less than or equal to D8. These constraints mean labor used cannot exceed 100 and material used cannot exceed 80. Click OK when both constraints are listed. Also check Make Unconstrained Variables Non-Negative, if shown, so Solver does not suggest producing a negative number of products.
-
Choose a solving method and run it. Select Simplex LP from the solving-method list. This example is linear: the objective and resource calculations are sums of quantities multiplied by fixed values. Click Solve and wait for the Solver Results window. Choose Keep Solver Solution and click OK to retain the answer in the worksheet.
-
Check the result and save the workbook. For this model, Solver should set B2 to 40 and C2 to 20. That uses 2 × 40 + 1 × 20 = 100 labor hours and 1 × 40 + 2 × 20 = 80 material units, so both limits are met exactly. The profit in B6 is 40 × 40 + 30 × 20 = 2,200. Save the workbook so you keep the worksheet and Solver setup together. If the result differs, check the cell references and constraints before relying on it.
Common Mistakes
Entering a number instead of a formula as the objective. Solver needs a cell that recalculates when the changing cells change. If B6 contains a typed value rather than the profit formula, adjusting B2:C2 will not affect the objective. Confirm the objective cell displays a formula in the formula bar.
Choosing the wrong changing cells. Include the input cells that represent decisions, not labels, limits, or calculated totals. In the example, only B2:C2 should change. If you select B6 or the constraint cells, Solver may overwrite calculations or produce an irrelevant answer.
Leaving out a constraint or reversing it. A limit of at most 100 labor hours is B7 less than or equal to D7, not greater than or equal to D7. Review every business rule and its direction. Also check that constraint formulas point to the intended totals and not to a blank or unrelated cell.
Using an unsuitable method. Simplex LP is appropriate for linear relationships. A model with smooth nonlinear calculations may need GRG Nonlinear; formulas with jumps or non-smooth behavior may call for Evolutionary. Selecting a method that does not fit the model can prevent a solution or return an unsuitable one.
Tips
Keep input cells, formulas, and limits visually distinct. For example, use one fill color for decision cells, another for formulas, and clear labels for constraint totals. That makes it easier to verify the Solver window against the worksheet and reduces the chance of changing the wrong range.
Start with a small, simplified model. Make sure each formula changes as expected when you temporarily alter an input. Then add constraints one at a time and run Solver again. If you need whole-number production quantities, add an integer constraint for B2:C2: in the Add Constraint dialog, select that range, choose int in the relation list, and confirm. Integer restrictions can make a problem harder to solve, so add them only when fractional quantities are not practical.
Keep a copy of the original values before experimenting with different assumptions. Solver can replace the changing-cell values when you keep a solution. You can also save separate workbook copies for different scenarios, such as different resource limits or unit profits. Solver is designed to optimize the model you give it; it cannot determine whether your assumptions or input data are realistic.
Choose the objective carefully. Maximize profit, minimize cost, or target a specific result only when that reflects the actual question. If the objective formula does not include a decision variable, or if your constraints leave no possible values, Solver cannot produce a meaningful answer even when the add-in is enabled correctly.
Troubleshooting
Solver does not appear on the Data tab: Reopen File > Options > Add-ins, select Excel Add-ins in the Manage box, and click Go. Confirm Solver Add-in is checked. If it is missing from the list or Excel reports that it cannot load the add-in, restart Excel and check again. On a work or school computer, your administrator may control optional Office features; ask them for help if you cannot enable it.
The Solver button is disabled or the dialog will not solve: Confirm you have a workbook open and that Set Objective contains a valid worksheet cell. Check that By Changing Variable Cells contains the intended input range and that the objective is a formula dependent on those inputs. Remove accidental blank or invalid references, then try again.
Solver says no feasible solution: The constraints may conflict. For example, a required minimum could exceed a stated maximum, or the available resources may not permit the minimum production you specified. Temporarily review or remove constraints one at a time to identify the conflict, then correct the model. Do not keep a solution that violates a real-world requirement just to make Solver finish.
The answer looks wrong or Solver stops without a useful result: Check units, formula references, and whether constraints use the right direction. For linear models, choose Simplex LP. For a nonlinear model, select the appropriate nonlinear method and verify that the starting values are reasonable. If the model has whole-number or yes/no decisions, add integer or binary restrictions as needed; an unrestricted continuous solution may contain values that cannot be used in practice.
You are using Excel for the web: The web app does not run the desktop Solver Add-in. Choose Open in Desktop App from the workbook interface, enable Solver in desktop Excel, and run the model there. If you do not have the desktop app, you will need access to a compatible Excel desktop installation to use this add-in.
Frequently Asked Questions
Is Solver included with Excel?
Solver is available as a Microsoft Excel Add-in in supported desktop versions, but it may not be enabled by default. Use the Excel Add-ins dialog to switch it on. You do not normally need to buy or download a separate Solver program.
Where is Solver in Excel after I enable it?
In Windows desktop Excel, open the Data tab and look for Solver in the Analysis group. If it is not there, return to File > Options > Add-ins and confirm Solver Add-in is checked. On Mac, enable it from Tools > Excel Add-ins, then look for Solver on the Data tab.
Can I use Solver in Excel for the web?
No. Excel for the web can open and edit many workbooks, but it does not run the desktop Solver Add-in. Open the workbook in desktop Excel to configure and solve the model.
Why does Solver need a formula cell?
The objective formula gives Solver a measurable result to improve, such as profit or cost. Solver changes the cells you designate and recalculates the objective and constraints to find values that meet the limits. A fixed number that does not depend on the changing cells gives Solver nothing to optimize.
Which Solver method should I choose?
Use Simplex LP when the objective and constraints are linear, as in the product example. Use GRG Nonlinear for many smooth nonlinear models, and consider Evolutionary for models involving discontinuities or non-smooth formulas. If you are unsure, inspect the formulas and test whether changing inputs affects the results as expected.
Can Solver return whole numbers?
Yes. Add an integer constraint to the decision-cell range when quantities must be whole numbers, or use a binary restriction when a decision can only be 0 or 1. These restrictions can take longer to solve, so use them only when the problem requires them.
Related
- Excel Date Conversion Methods for Text and Serial Values
- Find Excel Workbook Links in Microsoft Excel
- Excel Very Slow Saving Files? Causes and Fixes
Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.
More in How-to basics
- Power Query to Combine Excel Files: A Practical GuideTo combine multiple Excel files in Microsoft 365 for Windows, put them in one folder, then select Data…
- Excel Shortcut Between Sheets: Windows, Mac, and WebIn Excel for Microsoft 365 on Windows, press Ctrl+Page Up to move to the previous sheet tab, or…
- Circular References in Excel: How to Find and Trace ThemTo see circular references in Excel for Microsoft 365 on Windows, open the Formulas tab, choose Error Checking…
- How to Combine Cells in Excel Into One Cell EasilyTo combine the contents of Excel cells into a new cell, join them with the ampersand operator (&)…
- Excel Shortcut to Go to a Cell: F5, Ctrl+G, and MoreIn Excel for Microsoft 365 on Windows, press F5 or Ctrl+G to open the Go To dialog, type…
- Switch Excel Sheet Shortcut: Windows, Mac, and TipsIn Excel for Microsoft 365 on Windows, press Ctrl+Page Down to move to the next worksheet and Ctrl+Page…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.