Solver in Excel: Optimization Add-in for Linear, Nonlinear, and Mixed-Integer Problems
Solver in Excel β π enable the add-in, set objective and variable cells, choose Simplex LP, GRG Nonlinear, or Evolutionary, and solve real optimization

Solver in Excel is a free add-in for desktop Excel that finds the cell values that maximize, minimize, or hit a target in an objective cell, subject to constraints you set. It is turned off by default: enable it under File β Options β Add-ins (Manage: Excel Add-ins β Go), and the Solver button then appears in the Analysis group on the Data tab.
Solver in Excel is the optimization add-in that Microsoft provides for desktop Microsoft Excel. It finds the values of a set of decision cells that maximize, minimize, or hit a target value in an objective cell, subject to constraints you define.
If you've ever wanted Excel to answer a question like "what mix of products gives the highest profit if I only have 200 labor hours and $50,000 of raw material?" β Solver is the tool for the job. Goal Seek handles a single input changing a single output; Solver handles many inputs, many constraints, and any of three different solving algorithms depending on the structure of your problem.
Solver remains underused. Most users don't know it's there. Even users who've heard of it often back away because the dialog box looks intimidating and the math sounds graduate-level. The reality is friendlier β Solver is a wrapper around three well-tested optimization algorithms (Simplex LP, GRG Nonlinear, Evolutionary), and the bulk of the work is just laying out your problem clearly on the worksheet. Once the data is in shape, telling Solver what to do takes about thirty seconds.
This guide walks through everything you need to actually use Solver: turning the add-in on (it's installed but disabled by default), the three solving methods and when each one applies, the structure of an optimization problem in spreadsheet form (objective, variables, constraints), four classic real-world problems Solver handles well, the error messages you'll hit and how to read them, how Solver compares to Goal Seek, Data Tables, and Scenario Manager, the variable limits in the bundled version versus the paid Premium Solver upgrades, and the VBA commands for running Solver from automated workbooks.
By the end, you'll have a usable mental model of when Solver is the right tool and when it isn't.
Whether you're building a production schedule, a portfolio allocation, a shipping plan, or a staff roster, the same Solver pattern shows up: lay out the decision cells, write a formula that summarizes what you want to optimize, list the constraints the answer must satisfy, then let Solver search. Some problems solve in milliseconds.
Others β especially nonlinear and integer-heavy ones β can take minutes and still not converge to a clean answer. Reading the result reports tells you which case you're in and whether the answer you got is provably optimal or just the best Solver could find inside its time budget.
Many readers pair this guide with the microsoft excel exam practice test to check their readiness before exam day.
Readers who want more detail usually continue with solver in excel.
Solver in Excel at a glance
What it is: a free add-in bundled with Excel that solves optimization problems β find the cell values that maximize, minimize, or hit a target. How to enable: File β Options β Add-ins β Manage Excel Add-ins β Go β check Solver Add-in β OK. The Solver button appears in the Analysis group on the Data tab. Three methods: Simplex LP (linear), GRG Nonlinear (smooth nonlinear), Evolutionary (any function, slower). Variable limit: up to 200 variable cells. Common siblings: Goal Seek (one variable), Data Tables (sensitivity), Scenario Manager (named cases).
Enabling the Solver add-in
Solver ships with Excel but is turned off by default. To switch it on, go to File β Options β Add-ins. At the bottom of the dialog, select Excel Add-ins from the Manage dropdown and click Go. In the small add-ins window that pops up, tick the Solver Add-in checkbox and click OK. Excel installs the add-in and adds a Solver button to the Data tab (in the Analysis group). The whole process takes about ten seconds and only needs doing once per Excel install.
On Mac, the path is slightly different: Tools β Excel Add-ins, then check Solver Add-in. The Solver button shows up under the Data tab the same way it does on Windows. Excel for the web does not support add-ins such as Solver β you'll need desktop Excel to run optimization. If the Solver Add-in checkbox isn't visible in the Add-ins dialog at all, it usually means Excel was installed without the optional components.
If Solver was installed by an IT department on a managed machine, the add-in may already be enabled when you open Excel for the first time. You can confirm by checking the Data tab β if a Solver button is visible at the right end, you're ready to go. If not, the enable steps above are all that's required. There's nothing to download separately and no license to activate; the bundled Solver is fully functional within its size limits and works in desktop Excel on Windows and Mac.
The bundled Solver is built by Frontline Systems, the same company that makes commercial optimization products. Frontline's website (solver.com) offers paid upgrades β Premium Solver, Risk Solver Platform, Analytic Solver β that add capabilities beyond the bundled add-in.
Solver facts at a glance
| Item | Verified fact (Microsoft) |
|---|---|
| GRG Nonlinear | Use for problems that are smooth nonlinear. VBA Engine code 1. |
| Simplex LP | Use for problems that are linear. VBA Engine code 2. |
| Evolutionary | Use for problems that are non-smooth. VBA Engine code 3. |
| Variable cells | Up to 200 variable cells can be specified. |
| Constraint relations | <=, =, >=, int (integer), bin (binary), dif (all different). |
| Button location | Data tab, Analysis group (after the add-in is loaded). |
| Windows enable path | File β Options β Add-Ins β Manage: Excel Add-ins β Go β tick Solver Add-in β OK. |
| Mac enable path | Tools β Excel Add-Ins β tick Solver Add-In β OK. |
| Excel for the web | Add-ins are not supported; open the file in desktop Excel. |
| VBA reports (Simplex LP or GRG) | SolverFinish ReportArray: 1 Answer, 2 Sensitivity, 3 Limits. |

The three solving methods
For problems where the objective and all constraints are linear β meaning they involve only addition, subtraction, and multiplication by constants. No exponents, no IF statements, no MIN/MAX functions inside the formulas Solver touches. Simplex LP is the fastest, most reliable method and returns a globally optimal answer when one exists. Production mix, blending, transportation, and assignment problems are nearly always linear and should use Simplex LP for best results.
Generalized Reduced Gradient method for smooth nonlinear problems β anything that includes products of variables, exponents, logs, or other curved functions in the objective or constraints. GRG converges quickly when the problem has a single optimum near the starting values but can get stuck on a local maximum if the surface has many peaks. Portfolio optimization with quadratic risk terms, curve fitting, engineering design with nonlinear physics, and pricing optimization with elasticity curves all sit in GRG territory.
A global search method that works on any function, including non-smooth ones with IF statements, lookups, ABS, MIN/MAX, or integer-only variables. Doesn't use derivatives, so it handles discontinuous problems Simplex LP and GRG can't. The trade-off is speed β Evolutionary runs much longer and never guarantees the answer is optimal, only that it's the best found within the time budget. Good for scheduling, routing, layout problems, and anywhere the math isn't smooth enough for GRG to handle reliably.
Real problems sometimes need switching between methods to see which gives the best answer. Start with Simplex LP if the problem looks linear. If Solver complains the model is nonlinear, retry with GRG. If GRG gets stuck or the problem has integers and conditionals, try Evolutionary. The Solver dialog has a Method dropdown that switches between the three without losing your other settings. It's fine to try all three on the same model and compare the answers β that's often what experienced users do.
All three methods can handle integer constraints (variable must be whole numbers) or binary constraints (must be 0 or 1) added as ordinary constraints in the dialog. Integer programming is slower than continuous LP because the solver must search a discrete grid, but Simplex LP with integer constraints handles the classic assignment, set covering, knapsack, and facility location problems well. For mixed-integer nonlinear problems, switch to Evolutionary β the smooth GRG method struggles when some variables must be discrete.
Most spreadsheet optimization problems are linear, even when they don't look like it at first glance. If your formulas use only SUM, SUMPRODUCT, addition, and multiplication by constants, Simplex LP applies and will be fastest. The moment you include IF, MIN, MAX, VLOOKUP, or multiply two decision variables together, you've moved into nonlinear territory and need GRG or Evolutionary. Recognizing which camp your problem sits in before opening Solver saves the cycle of failed runs and confusing error messages later.
Setting up an optimization problem in Excel
Every Solver problem has three ingredients on the worksheet: the objective cell (what you're trying to maximize, minimize, or set to a value), the variable cells (the inputs Solver is allowed to change β usually called decision variables), and the constraints (rules the answer must satisfy). The worksheet layout doesn't matter as long as Solver can reference each piece, but a clean convention is decision variables in one row or column, formulas computing intermediate values in another, and the objective formula in a clearly labelled cell at the top or bottom of the layout.
The objective is a single formula cell whose value you want to optimize. In a profit-maximization problem, the objective cell contains =SUMPRODUCT(unit_profits, units_made). In a cost-minimization problem, =SUMPRODUCT(unit_costs, units_shipped). The objective formula must depend on the decision variables β directly or through other formulas β or Solver has no way to change its value. The Set Objective box in the Solver dialog points at this cell, and the Max/Min/Value Of radio buttons tell Solver which way to push it.
The variable cells (also called decision variables or changing cells) are the inputs Solver can adjust. These should usually start at zero or a reasonable guess β Solver uses their initial values as a starting point, and on nonlinear problems the starting values can affect which local optimum it converges to. The By Changing Variable Cells box in the dialog points at this range. Solver tries different values in these cells, watches the objective cell, and homes in on the combination that gives the best objective value while staying inside the constraint rules.
The constraints capture the real-world rules β total labor hours used can't exceed available labor, production must meet minimum order quantities, units made must be whole numbers, percentages must sum to one hundred. Constraints are added one at a time in the dialog using a left-hand-side cell reference, a comparison operator (β€, β₯, =, int, bin, dif), and a right-hand-side value or cell.
The constraints box typically grows to ten or twenty rows for non-trivial problems. Keep them organized β Solver will tell you which constraint is violated when no feasible solution exists, but only by row number, not by description.
Classic Solver problems
A factory makes several products. Each product earns a known profit per unit and uses different amounts of labor, machine time, and raw material. Total labor, machine time, and material per period are limited. Decision variables: how many of each product to make. Objective: maximize total profit (SUMPRODUCT of profits and units). Constraints: total labor used β€ labor available, total machine time used β€ machine time available, total material used β€ material available, units made β₯ 0, units made = integer if products can only be made whole. Simplex LP solves this in milliseconds for any reasonable size.
Step by step β running Solver the first time
Once your data is laid out and the formulas check out, running Solver itself is a six-step routine. Step one: click the Solver button on the Data tab. Step two: click the box next to Set Objective, then click the objective cell on the worksheet.
Step three: choose Max, Min, or Value Of (and enter a target if Value Of). Step four: click in the By Changing Variable Cells box and select the decision variables. Step five: click Add in the Subject to the Constraints box and enter each constraint one at a time β cell reference, operator, value or cell. Step six: pick a Solving Method from the dropdown and click Solve.
Solver runs and shows a results dialog. If it found a solution, it offers to keep the Solver answer (which has overwritten your variable cells with the optimal values) or revert to the original values. It also offers three reports β Answer, Sensitivity, and Limits β that can be added to new worksheets.
The Answer report summarizes the optimal values and constraint usage. The Sensitivity report shows how much the objective changes if a constraint or coefficient shifts (available with Simplex LP and GRG Nonlinear). The Limits report shows the range each variable could take while staying feasible with the others fixed at their optimal values.
For ongoing use, the entire Solver setup is saved with the workbook. Reopen the file later, click Solver, and the objective, variables, constraints, and method are all preserved. You can also save multiple Solver models in the same workbook using Load/Save in the Options dialog β useful for keeping several variants of the same problem (different scenarios, different products) in one file. The Options dialog also controls iteration limits, time limits, precision, and convergence tolerance, which you'll touch when default Solver runs don't converge or take too long on large problems.
One habit that saves frustration: always run Solver once with small, hand-crafted test data before unleashing it on the real numbers. Build a five-variable, three-constraint version where you already know the answer. Run Solver. If it returns the answer you expected, your model structure is correct and you can swap in real data with confidence. If it returns something weird, you'll catch the bug in the model setup rather than spending an hour debugging a real-data result that seemed plausible enough to ship before you noticed the constraint pointing at the wrong cell.

Solver overwrites your variable cells with new values during the run, and the results dialog asks afterward whether to keep them or revert. If Excel crashes mid-run (rare on small problems, occasional on large nonlinear ones), the original values are lost. Save the workbook before clicking Solve, especially on the first run of a new model. Better still, keep the decision variables in their own dedicated column with a copy in another column you don't touch β that way even a crashed run leaves the original baseline intact for reference and comparison.
Reading Solver's result messages
Solver always returns a message at the end of the run, and reading it correctly is half the skill. "Solver found a solution. All constraints and optimality conditions are satisfied" is the message you want β it means the answer is provably optimal (for Simplex LP and GRG, when it converges). "Solver has converged to the current solution. All constraints are satisfied" means GRG stopped because successive iterations weren't improving the objective much β the answer is feasible but might not be the global optimum. Try different starting values or switch to Evolutionary to check.
"Solver could not find a feasible solution" means no combination of variable values satisfies all the constraints simultaneously. The constraints contradict each other or are too tight. Open the constraint list and look for the bottleneck β usually a constraint that can't be met given the other limits. Relax one constraint at a time until the problem becomes feasible, then you've identified which limit is the binding one. A common cause is forgetting to set variable cells β₯ 0; negative units made or negative percentages allocated lead to weird infeasible models.
"The Set Cell values do not converge" means the objective can grow without bound β your problem is missing a constraint that should be limiting it. In a profit-max problem, this usually means resource constraints aren't connected to the variables properly. Check the constraint formulas reference the actual decision variables. "Stop chosen when iteration limit reached" or "Stop chosen when time limit reached" means Solver was making progress but ran out of budget. Increase Max Iterations or Max Time in the Options dialog and run again, or accept the current answer if it looks reasonable.
"Solver encountered an error value in the objective or a constraint" means one of your formulas returned #DIV/0!, #VALUE!, or another error during the search. Solver tried a combination of variable values that broke a formula. The fix is either guarding your formulas with IFERROR so they return a number instead of an error, or adding constraints that prevent Solver from exploring the bad region (variables β₯ some small positive number to avoid divisions by zero, for example). Diagnose by manually entering values close to where Solver was searching and watching which formula breaks.
Solver problem setup β quick checklist
- βEnable the Solver add-in via File β Options β Add-ins β Manage Excel Add-ins β Go β check Solver Add-in.
- βLay out decision variables in a contiguous range β usually one row or one column.
- βWrite a single objective formula that depends on the decision variables (directly or through helpers).
- βBuild constraint left-hand sides as formulas that compute resource use, totals, or quality from the decision variables.
- βSet Max/Min/Value Of correctly β wrong direction is a common first-time mistake.
- βAdd non-negativity constraints (variables β₯ 0) unless negative values genuinely make sense in your problem.
- βAdd int or bin constraints where variables must be whole numbers or binary on/off choices.
- βPick Simplex LP for linear problems, GRG Nonlinear for smooth nonlinear, Evolutionary for non-smooth or integer-heavy.
- βSave the workbook before clicking Solve to protect against mid-run crashes on large nonlinear problems.
- βGenerate the Answer report on the first run to verify the constraints behave the way you expected.
Solver vs. Goal Seek vs. Data Tables vs. Scenario Manager
Excel's what-if analysis tools form a small family with overlapping but distinct purposes. Understanding which one fits the question saves a lot of fumbling. Goal Seek answers "what input value makes this output equal a target?" β single variable, single constraint, no optimization. If a loan calculator shows a monthly payment of $1,250 and you want to know what loan principal would produce $1,000, Goal Seek finds it in seconds. Goal Seek lives under Data β What-If Analysis β Goal Seek and runs a simple iterative search with no method choice or constraints beyond the target value.
Data Tables answer "how does this output change as one or two inputs vary across a range?" β sensitivity analysis with no optimization. A one-variable data table shows the objective at every value of a single input. A two-variable data table shows the objective at every combination of two inputs as a grid. Useful for charting how profit responds to price, or how a project NPV changes with discount rate and growth assumptions. Found under Data β What-If Analysis β Data Table after laying out the input range and a formula referencing the input cell.
Scenario Manager answers "what does the model look like under three or four named sets of assumptions?" β case-based comparison, no search or optimization. Define a scenario as a named bundle of input values (Best Case, Worst Case, Most Likely) and Excel lets you switch between them and see how the worksheet responds. Useful for executive-style sensitivity reporting where the question is comparing a small number of curated scenarios rather than exploring a continuous input range. Under Data β What-If Analysis β Scenario Manager.
Solver is the optimization tool the other three aren't. Many decision variables, many constraints, three solving methods, and a search algorithm that finds the optimum rather than just reporting outputs at sampled inputs. For an actual optimization question ("what mix of products maximizes profit?"), Solver is the only built-in answer. For a sensitivity question ("how does profit shift if material costs rise 10%?"), Data Tables or Solver's Sensitivity Report fits better. Knowing which question you're actually asking points you at the right tool immediately rather than after a few wrong starts.
Size limits and the Premium upgrade
Microsoft's Solver documentation states you can specify up to 200 variable cells. The count includes every cell in the By Changing Variable Cells range, so a 20 x 10 grid of decision values uses all 200. A production mix with 30 products or a transportation problem with a dozen factories and a dozen warehouses fits comfortably.
When a problem exceeds the limit, the paid Frontline Systems products are the vendor upgrade path; check solver.com for current limits and pricing. An alternative is to split a large problem into smaller regions that each fit in the standard Solver, though that rarely gives a truly globally optimal answer. For regular large-scale work, dedicated tools such as Python's scipy.optimize, cvxpy or pulp, R's lpSolve, or commercial systems like Gurobi and CPLEX are common next steps.

Solver in Excel β quick numbers
Automating Solver with VBA
Clears any existing Solver settings from the active worksheet. Call this first at the top of any VBA routine that configures and runs Solver, so you start from a clean slate rather than inheriting settings from a previous run. Without SolverReset, leftover constraints or variable references from a different problem can produce confusing results when the macro runs against new data. Listed as Sub call, no arguments required.
Sets the main Solver parameters: objective cell, max/min/value direction, target value (for Value Of), variable cells, and solving method. Syntax: SolverOk SetCell:="$D$15", MaxMinVal:=1, ValueOf:=0, ByChange:="$B$2:$B$11", Engine:=2, EngineDesc:="Simplex LP". The Engine number is 1 for GRG Nonlinear, 2 for Simplex LP, 3 for Evolutionary. Equivalent to setting the objective, variable cells and method in the Solver Parameters dialog.
Adds a single constraint to the model. Called once per constraint. Syntax: SolverAdd CellRef:="$D$20", Relation:=1, FormulaText:="100". Relation codes: 1 is β€, 2 is =, 3 is β₯, 4 is integer, 5 is binary (0 or 1), 6 is all-different integers. For 4, 5 and 6, omit FormulaText. To rebuild a model with five constraints, call SolverAdd five times. Equivalent to clicking Add in the constraints section of the Solver dialog box and entering each row by hand.
SolverSolve runs the optimization. SolverSolve UserFinish:=True suppresses the results dialog so the macro doesn't pause waiting for user input. SolverFinish KeepFinal:=1 keeps the Solver answer in the variable cells; KeepFinal:=2 reverts to original values. Pair these two at the end of a Solver macro to make the optimization run silently and leave the optimal values in place for downstream worksheet calculations to use directly without manual confirmation steps.
VBA automation β running Solver from code
For workbooks that run optimization repeatedly β daily, weekly, on demand β wrapping Solver in a VBA macro eliminates the manual setup each time. The Solver VBA functions sit in a separate library that has to be referenced from the VBA project: in the VBA editor, go to Tools β References, scroll to SOLVER, and tick the box. Without this reference, calls to SolverOk, SolverAdd, and SolverSolve fail with a compile error because VBA doesn't know where the functions live.
A minimal Solver macro looks something like: SolverReset to clear any previous setup, then SolverOk SetCell:=Range("D15").Address, MaxMinVal:=1, ByChange:=Range("B2:B11").Address, Engine:=2 to point at the objective and variables and pick Simplex LP, then SolverAdd CellRef:=Range("D20").Address, Relation:=1, FormulaText:="100" for each constraint, and finally SolverSolve UserFinish:=True followed by SolverFinish KeepFinal:=1. Six lines of code, give or take, replace the entire dialog box workflow.
The MaxMinVal codes: 1 maximize, 2 minimize, 3 value of. The Engine codes: 1 GRG Nonlinear, 2 Simplex LP, 3 Evolutionary. Relation codes in SolverAdd: 1 is <=, 2 is =, 3 is >=, 4 integer, 5 binary, 6 all-different. The full function reference is on Microsoft Learn under "Using the Solver VBA Functions".
A common production pattern is to wrap the Solver call in a routine that copies fresh input data into the worksheet, runs Solver, captures the optimal variable values into a results sheet, and loops over multiple scenarios. A workbook can run dozens of optimization scenarios in a few minutes without any manual intervention. This pattern shows up in financial planning models, supply chain dashboards, and resource allocation tools where the same optimization runs against rolling input data and the answer feeds downstream reports automatically through normal worksheet recalculation paths.
Official Resources
- Define and solve a problem by using Solver β Microsoftβs official Solver guide covering the objective cell, variable cells, constraints, and the three solving methods.
- Load the Solver Add-in in Excel β Microsoftβs step-by-step instructions for enabling Solver on Windows and Mac.
Solver in Excel β pros and cons
- + β
- + β
- + β
- + β
- + β
- β β
- β β
- β β
- β β
- β β
π― What is the objective cell in Excel Solver?
The single formula cell whose value Solver tries to maximize, minimize, or set to a target. It must depend on the variable cells, directly or through other formulas, or Solver has nothing to optimize.
START EXCEL PRACTICE TESTπ’ What are variable cells in Solver?
Also called decision variables or changing cells, these are the inputs Solver is allowed to adjust. Solver tries different combinations of these values while watching the objective cell and respecting every constraint.
START EXCEL PRACTICE TESTπ When should I use Simplex LP in Excel Solver?
Use Simplex LP when the objective and every constraint are linear β built only from addition, subtraction, and multiplication by constants. It is the fastest method and returns a globally optimal answer when one exists.
START EXCEL PRACTICE TESTπ When does GRG Nonlinear fit a Solver problem?
GRG Nonlinear suits smooth nonlinear problems β formulas with products of variables, exponents, logs, or other curved functions. It converges fast near a single optimum but can settle on a local optimum on multi-peaked surfaces.
START EXCEL PRACTICE TEST𧬠What makes the Evolutionary method different?
Evolutionary is a genetic-algorithm search that works on any function, including non-smooth ones with IF, lookups, ABS, MIN/MAX, or integer-only variables. It runs slower and never guarantees a provably optimal answer.
START EXCEL PRACTICE TESTβοΈ How many variable cells can Solver handle?
Microsoft documents a limit of up to 200 variable cells in the bundled Solver add-in, counting every cell in the By Changing Variable Cells range. Larger models need Frontlineβs paid Premium Solver products or a dedicated optimization tool.
START EXCEL PRACTICE TESTπ§© What constraint operators does Solver support?
Solver constraints use β€, =, β₯, plus int (integer), bin (binary 0/1), and dif (all different). Each constraint is a left-hand-side cell, an operator, and a right-hand value or cell, added one at a time in the dialog.
START EXCEL PRACTICE TESTπ₯οΈ Does Excel for the web support Solver?
No. Microsoft states add-ins are not supported in Excel for the web, so Solver only runs in desktop Excel on Windows or Mac. It is also unavailable on mobile versions of Excel.
START EXCEL PRACTICE TESTπ What are the three Solver result reports?
After a successful run, Solver can generate an Answer report (optimal values and constraint usage), a Sensitivity report (how the objective reacts to coefficient or constraint changes), and a Limits report (feasible ranges per variable).
START EXCEL PRACTICE TESTπ» Which VBA calls run Solver from code?
A macro pattern of SolverReset, SolverOk (objective, variables, engine), SolverAdd (one call per constraint), SolverSolve, and SolverFinish runs Solver without opening the dialog β useful for workbooks that re-optimize on a schedule.
START EXCEL PRACTICE TESTExcel Questions and Answers
About the Author

Business Consultant & Professional Certification Advisor
Wharton School, University of PennsylvaniaKatherine Lee earned her MBA from the Wharton School at the University of Pennsylvania and holds CPA, PHR, and PMP certifications. With a background spanning corporate finance, human resources, and project management, she has coached professionals preparing for CPA, CMA, PHR/SPHR, PMP, and financial services licensing exams.