Solver for Google Sheets ES Notify me
  1. Home
  2. Solver in Google Sheets

Guide

Solver in Google Sheets: how to get it and use it, step by step

Google Sheets doesn’t include Excel’s Solver. Here’s how to get it for free, how to use it, with a two-part workshop as the example, and how to read the result.

10 min read

In short

  • An optimization problem has three parts: what you decide, what you want to achieve and what limits you.
  • In a sheet you write it as a table: one column per decision and one row per limit, using SUMPRODUCT.
  • To solve it for free in Google Sheets: our template, the OpenSolver add-on, or download the sheet and use Solver in desktop Excel or LibreOffice. To try it with nothing to install, the online solver.
  • The result is only as good as the model: always review it before you decide.

Does Google Sheets have a Solver?

Not built in. Excel ships Solver as a free add-in; Google Sheets has no menu or function that does the same. But you can get it for free in three ways, explained below: a script template like ours, the OpenSolver add-on, or downloading the sheet and using Solver in desktop Excel or LibreOffice.

Before installing anything, it helps to understand what a Solver does. It takes five minutes.

What an optimization problem is

Whenever you have to decide how much of several things to do without going over your resources, you have an optimization problem. It always has three parts:

  • What you decide (the variables): how many units of each product to make, how many pallets to send down each route, how many people start their week each day.
  • What you want to achieve (the objective): the highest profit, the lowest cost, the smallest team.
  • What limits you (the constraints): machine hours, materials, budget, what customers order.

When the objective and the constraints are sums of quantities multiplied by fixed numbers, the problem is a linear program. That’s what Excel’s Solver solves with its “Simplex LP” method, and what our template solves. If some decisions must also be whole numbers (people, batches) or a yes or no (approve a project), it’s an integer program, and it can be solved too.

The example: a workshop with two parts

A workshop makes two parts, A and B. These are its numbers (made up, for learning):

Part APart BAvailable
Profit per part$40$30—
Lathe hours per part21100 h a week
Mill hours per part1180 h a week
What customers order40 at mostno limit—

The question: how many of each part should it make every week to earn the most? Written as a model:

Maximize 40·A + 30·B profit in $

subject to 2·A + B ≤ 100 lathe hours

A + B ≤ 80 mill hours

A ≤ 40 orders for A

A ≥ 0, B ≥ 0 no negative production

If you think “make as many A as possible, it earns the most”, you get 40 parts A and 20 B: $2,200. That isn’t the best. The best is 20 parts A and 60 B: $2,600 a week. The chart below shows why.

See it in a chart: the best plan is at a corner

With two variables you can draw it. Every point in the green area is a plan the workshop can carry out. The dashed line joins plans with the same profit: the further from the origin, the more profit. The best plan is the last point of the area the line touches, and it’s always a corner.

Move the profits and watch the best corner jump:

If part B earns more than part A, the best plan makes no A at all. If A earns more than twice as much as B, the best plan makes every A customers order. In between, the 20 and 60 mix.

With twenty variables you can’t draw it anymore, but the idea is the same. That’s what a Solver does: it finds the best corner without drawing anything.

How to use Solver in Google Sheets: the model in your sheet

The clearest layout is a table: one column per variable and one row per constraint. This is the “Workshop” tab of the template:

Solver template · Workshop Solver
The workshop model written in the sheet, with the solution already calculated.
RowABCDEFG
5ObjectiveMaximizeObjective value$2,600
6Status✓ Optimal solution
8VariablesPart APart B
9TypeContinuousContinuous
10Min00
11Max
12Obj. coefficients4030
13Solution2060
15ConstraintsPart APart BUsedSignLimitSlack
16Lathe hours21100≤1000
17Mill hours1180≤800
18Part A orders1020≤4020
Grey cells hold formulas. Green is what Solver writes.

The three formulas you need are all the same function, SUMPRODUCT, which multiplies each number in one row by the matching number in another and adds everything up. Total profit, in D5:

D5=SUMPRODUCT(B12:C12,B13:C13)

That is, 40 × 20 + 30 × 60 = 2,600. Lathe hours used, in D16:

D16=SUMPRODUCT(B16:C16,$B$13:$C$13)

The $ signs lock the solution row so you can copy the formula down to every constraint. Slack is what’s left before the limit: =F16-D16 when the sign is ≤.

If your spreadsheet uses a comma for decimals (for example with a Spanish, French or German locale), separate arguments with semicolons: =SUMPRODUCT(B12:C12;B13:C13).

Three tips that save trouble:

  • Same units across a row. If the limit is in hours, so are the coefficients; don’t mix hours and minutes.
  • One constraint per row, with its sign written out. “At least” is ≥ and “at most” is ≤.
  • Test the model by hand before solving. Type a solution you know into the “Solution” row and check that profit and hours come out as expected.

How to get Solver in Google Sheets: three free ways

There’s no switch to turn on: you have to add it to the sheet. These are the three free ways, from quickest to most work.

1. With the free template

It’s a Google Sheet with a script that uses the optimization engine Google includes in its spreadsheets. It comes with this workshop and a blank model for your own problem.

  1. Make a copy. Click the button below, then “Make a copy”. It’s saved to your Google Drive.
  2. Type in your numbers. Adapt the example tab or fill in “My model”.
  3. Solve. From the menu, SolverSolve this tab. The first time, Google asks your permission to run the script in your copy; it’s explained step by step on the template page.
  4. Read the result in the green “Solution” row and in “Objective”.

Make a copy of the template

Just want to try it first? The online solver solves the same model in your browser, with nothing to copy and no permissions. This guide’s workshop is already loaded.

Solve this example online

2. With the OpenSolver add-on

OpenSolver is free and open source, and has long been the best-known option. To install it:

  1. Open the add-on store. In your sheet, ExtensionsAdd-onsGet add-ons.
  2. Search for “OpenSolver” and click InstallContinue.
  3. Open it from the Extensions menu. A side panel opens where you set the objective cell, whether to maximize or minimize, the variable cells (the “Add” button) and the constraints.
  4. Click “Solve Model”.

Two things to know first, both acknowledged on its own website: since June 2021 a change by Google broke it for some users, and it has trouble when sheet names contain spaces. Also, each solve can run for at most 6 minutes, Google’s limit for scripts. It’s maintained by volunteers. If it doesn’t work for you, see what to check and what to use instead.

3. With Solver in desktop Excel or LibreOffice

If you have Excel installed, download the sheet with FileDownloadMicrosoft Excel (.xlsx) and open it there. Solver comes with Excel, but you have to enable it once in the add-in options. Then it’s on the Data tab: choose the objective cell, the changing cells, the constraints and the “Simplex LP” method. Note that Excel for the web has no Solver.

LibreOffice Calc is free and has its own Solver under ToolsSolver.

And if your company uses a paid Google Workspace plan (Business Standard or higher), Gemini in Sheets can also set up optimization problems since April 2026. Review the model it proposes as carefully as you’d review your own.

How to read the result

For the workshop, Solver answers: 20 parts A and 60 parts B, for $2,600 profit a week. The “Slack” column tells the rest of the story:

  • Lathe and mill: slack 0. They’re at their limit. They’re the bottlenecks: what holds profit back.
  • Orders for part A: slack 20. Twenty orders go unfilled, and it doesn’t matter: even if customers ordered more A, you wouldn’t earn more, because there are no hours to make them.

What is one more hour worth?

It’s the most useful question, and you answer it by solving again with the limit a little higher:

With 101 lathe hours

$2,610

One more lathe hour is worth $10.

With 81 mill hours

$2,620

One more mill hour is worth $20, twice as much.

If you can buy extra hours, start with the mill, as long as an hour costs you less than $20. That value is called the shadow price, and it only holds for small changes: if you add many hours, another constraint becomes the one that binds and you need to solve again.

Solver finds the best answer to the model you give it, not to your real problem. If you forget a constraint, the result may be impossible to carry out. Always check that the model describes the problem well before making a decision with it.

Common errors and what they mean

“No feasible solution” (infeasible)

No combination meets every constraint at once. It’s almost always a sign the wrong way round (≥ where ≤ belonged) or an impossible minimum: for example, a contract that requires more than the hours allow. Check the “at least” rows first.

“The objective can grow forever” (unbounded)

A constraint is missing. If nothing limits a variable that adds profit, Solver would make it infinite. It’s usually the maximum demand, the hours or the materials.

“I get decimals and I need whole numbers”

Mark those variables as integer (in the template, “Integer” in the “Type” row). Rounding isn’t enough: it can break a constraint or leave you far from the best result.

“The solution makes no sense”

Solver did its job on an incomplete model. Look for the missing constraint (whatever would stop that plan in real life) or mixed units in a row.

How to tell if your problem is linear

Your problem is linear if each variable only appears multiplied by a fixed number and added up. It stops being linear if:

  • two variables are multiplied together (for example, price × quantity, if you decide both);
  • there are powers, roots or divisions by a variable;
  • a formula uses IF, MAX or MIN on the variables.

For nonlinear problems, desktop Excel’s Solver has the “GRG Nonlinear” method. Many “if I do this, then that” conditions can be written as linear ones with binary variables.

Frequently asked questions

Does Google Sheets have a Solver?

Not built in: Google Sheets doesn’t include Excel’s Solver, and there’s no menu or function that does the same. You can get it for free in three ways: a script template like ours, the OpenSolver add-on, or downloading the sheet and using Solver in desktop Excel or LibreOffice.

Is there a Solver add-on or extension for Google Sheets?

Yes. In Extensions → Add-ons → Get add-ons you’ll find free and freemium options; OpenSolver is the best known. If you’d rather not install an add-on, our template brings its own Solver menu as soon as you make a copy.

Is there a SOLVER function in Google Sheets?

No. No Google Sheets function finds a maximum or minimum subject to constraints. What you do have is SUMPRODUCT, which you use to write the model: total profit and how much of each resource is used. To solve it you need the template or an add-on.

What is the Google Sheets equivalent of Excel Solver?

There’s no built-in equivalent. The closest are an add-on such as OpenSolver or a template with a script, like ours, which uses the linear optimization service Google includes in Apps Script. Both solve the same kind of problems as Excel’s “Simplex LP” method.

Why is OpenSolver not working in Google Sheets?

Its own website says that since June 2021 a change by Google broke it for some users, and that it has trouble when sheet names contain spaces. Try removing the spaces from your tab names, or use the template. All the checks are in OpenSolver not working: what to check.

Can I do linear programming in Google Sheets?

Yes. Write the model as a table with SUMPRODUCT and solve it with the template or an add-on. Integer and binary (yes/no) variables work too. This guide walks you through an example.

Can Google Sheets solve nonlinear problems?

The template can’t: it solves linear problems, including integer and binary variables. For nonlinear models, desktop Excel’s Solver has the “GRG Nonlinear” method. Here’s how to tell if your problem is linear.

Is it free?

Yes. The template, OpenSolver and LibreOffice are free. Excel’s Solver comes with desktop Excel.

Waitlist

Want it in every sheet, without copying templates?

We’re considering building a Google Sheets add-on with Solver and Goal Seek. We’ll build it if there’s enough interest. Join the list and you’ll try it free before anyone else: we’ll e-mail you just once, if it launches, with your access.

  • It would read your model as it is, with your own formulas.
  • Integer and binary variables, plain-language reports and Goal Seek.
  • It would solve inside your browser: your data would never leave your sheet.

Free, no strings attached. No newsletters, no ads, and you can unsubscribe anytime. How we handle your e-mail.

You’re on the list. Thanks.If the add-on launches, we’ll e-mail you once with your free early access.

One last thing, if you like: what would you use it for?