**Goal Seek for Sheets** is an Add-On for Google Sheets for doing Goal Seek type data analysis.

In October 2019, Google launched an official Add-On, called “Goal Seek for Sheets”, and it is that Add-On that this tutorial references.

## 1. What is Goal Seek?

It’s a tremendously powerful and useful technique in data analysis. It’s a process where you set an output you want to achieve (e.g. break even, sell 10k units, save $1m) and let the computer find the input value that will get you there (e.g. 500 attendees, $100k capital lump sum, save $8k/year).

There are three components: 1) the *unknown input variable*, 2) the equation or calculation that is performed on the input variables to get the output, and 3) the *known output*.

The Goal Seek algorithm performs a series of “what-if” calculations by plugging in different input values. Each guess (hopefully) gets closer and closer to the solution.

For example, a classic use case of Goal Seek is to determine the number of sales required to break even, given other variables like fixed costs etc.

## 2. How do you use Goal Seek in Google Sheets?

Imagine Jennifer runs an annual conference for Google Sheet developers called “Sheet Freakz!”.

She has a great venue picked out with room for 500 and she’s confident she can fill it. She knows what her costs are — the rental fee for the room, the cost of catering, the cost of promoting the conference — and she has agreed to a $1,500 fee with 15 Google Sheets experts to come and talk about the latest and greatest in Sheets developments.

*(Editor note: I wish this was a real conference!! ? It is! It’s called SheetsCon. Check out 2020’s wrap up or watch the replays.)*

What price must she charge to cover her costs?

This is a classic break-even cost analysis example that the Goal Seek Add-On is ideally suited for solving.

### Setting up the Sheet

The first step is to simply add all of the known variables into a sheet, like so:

These are the variables that Jennifer knows at the start of her problem.

Next, add a line for the registration fee per attendee, but set it to 0 for now. I’ve highlighted the cell yellow to indicate that it’s the solution cell that I want Goal Seek to solve for:

Finally, add a profit line, which is my revenue (# of attendees * registration fee) less expenses (fixed costs + (# of speakers * speaker fee)):

`= ( B7 * B8 ) - ( B4 + ( B5 * B6 ) )`

Of course, initially, my profit is -$47,500 because I have no attendees and hence $0 revenue.

It’s time to use Goal Seek and let it find the break even registration fee for us.

### How do you add Goal Seek in Google Sheets?

Goal Seek is an Add-On, which means you need to add it to your Google Sheet before you can use it.

Search for “Goal Seek” in the Add-Ons marketplace, found under the menu `Add-ons > Get add-ons`

The official Google Add-On information page will appear.

Click to install. That’s all it takes to add it to your Sheets.

You can also find it in the G Suite marketplace directly by clicking here.

### Using Goal Seek

Open the Goal Seek sidebar: `Add-ons > Goal Seek > Open`

There are three pieces of information you need to enter:

#### i) Set Cell

Jennifer wants to know what price to charge to break even. In other words, what’s the minimum ticket price to ensure her profit is $0 and she doesn’t lose any money on the conference.

The “Set Cell” is the one we want to specify a value for. It’s the target we’re aiming for.

It’s the cell with the calculation formula in.

**** With the Goal Seek sidebar open, click on the cell with the formula, which is cell B10 in this case (1). Add that reference to the Goal Seek solver by clicking on the grid icon next to the Set Cell box (2). This will auto-populate with the cell B10 reference. ****

#### ii) To Value

Next, type in the value of the output you want to achieve in the “Set Cell” box.

In this example, we want to set the profit value to 0, so we simply type 0 into this input box.

#### iii) By Changing Cell

What input variable do we want to vary to solve our equation?

In this case, it’s the registration fee. It’s the variable that Jennifer is trying to find, such that her profit is $0 and she breaks even.

Select the cell that holds this variable and then click on the grid icon next to the input field to auto-populate it.

**Read it out loud to understand what you’re asking the application to do: “Set Cell X To Value Y By Changing Cell Z”.**

**In our case, “Set Cell Profit To $0 By Changing Cell Registration Fee” or even cleaner “Set Profit To $0 By Changing Registration Fee”.**

When you have all three inputs filled in for the Goal Seek application, the Solve button will turn blue and become active.

Press it.

The registration fee value will start jumping around all over the place as the computer tries different guesses to see what brings the profit value closer to 0.

Eventually, it’ll find a solution and notify you that it’s done!

In this example, it’s found that the break-even registration fee is $94.99999 dollars, or $95. Great!

Click here to open a Google Sheet template with all the examples from this tutorial >>

*(Feel free to make your own copy: File > Make a copy…*

*If the file won’t open without permission, please open in an incognito window and copy from there.)*

### Manual Checks

It’s always a good idea to check the final solution that the Add-On finds, and not just trust it blindly.

In our example, it’s very simple to check that the two sides of the equation balance.

Jennifer’s expenses to run the conference are:

**Expenses**

$25,000 fixed costs + ( 15 speakers @ $1,500 each ) = 25,000 + ( 15 * 1,500 ) = $47,500

And her revenue on the other side of the equation will be:

**Revenue**

500 attendees * $94.99 registration fee (Goal Seek solution) = $47,499.99

The difference is simply a rounding error.

This is good.

The result from the Goal Seek is indeed a solution that gets Jennifer the break even registration price.

Another way to look at how the Goal Seek solver works is to visualize it. A very simplified version might look something like this:

#### Attempt 1

The computer has no idea what the solution is, so it makes a guess. For example, it might overestimate the result:

#### Attempt 2

The computer makes another guess. This time it might underestimate the result:

(It won’t always be a neat over/under/over/under guess. For example, if it guesses low, it might take many guesses before the first “over” guess happens. So this over/under flow is just to illustrate the concept.)

#### Attempt 3

With each additional “guess” the computer gets more accurate, because it uses the information from prior guesses to get closer to the solution. It might still overestimate, as shown here, but it’s getting closer to the solution:

#### Attempts 4 onwards

So on and so forth, as the computer makes guesses that get closer and closer, under, over, under, over, under, over, etc. until the solution is found:

The program converges on the solution.

## 3. Other features of the Goal Seek Add-On

These features are all found in the sidebar underneath the input section for the Goal Seek variables.

### Options

Under the Options menu, you can adjust the default settings for the Goal Seek solver.

You can change the 1) max number of iterations, 2) the tolerance (how accurate you need to be) and 3) the maximum time limit for the process, in seconds.

I’d suggest that the default settings will suffice for the majority of scenarios, but it’s good to know that you can make these changes should you need to.

### Solve Status

The Solve Status box displays helpful information about the current Goal Seek solution.

It lets you know when the algorithm is finished, what the final status is, how many iterations it required and how long it took.

### History

Access previous runs of the Goal Seek solver under the History menu.

Use the drop-down menu to choose a prior solution based on a timestamp.

### Error Messages

Occasionally the Goal Seek solver fails to find a solution.

One reason might be that the computer guesses get successively further away from the actual solution. They *diverge* away from the solution.

Should this happen, you’ll see an error message like this:

## 4. More Goal Seek examples

### Conference Break Even Example For Attendee Numbers

In the conference example above, instead of knowing how many people would attend, suppose Jennifer knew the registration fee.

She charges $299 for the registration fee and wants to know how many attendees she requires to break even?

The “changing cell” in this case becomes the number of attendees, rather than the registration fee.

The setup would be:

The formula in cell B10 does not change from the original example. It’s still:

`= ( B7 * B8 ) - ( B4 + ( B5 * B6 ))`

The Goal Seek settings are:

Run Goal Seek and the answer comes back as 158.86.

In other words, Jennifer needs 159 attendees to pay a registration fee of $299 to break even.

### Mortgage Calculation Example

Suppose you’re looking to buy a new house. You have an upper limit for your monthly payments of $1,500.

The other known variables, in this case, are: it’s a 30-year term with an annual interest rate of 4.5%.

What’s the maximum amount you can borrow?

Goal Seek can solve this for you.

Firstly, setup the sheet with the known variables in your Sheet:

The payment equation uses the PMT function in Google Sheets in cell B8:

`= -PMT( B6 / 12 , B5 , B7 )`

In Goal Seek, set the “Set Cell” to be this equation in cell B8.

Set the “To Value” to $1,500 (the maximum monthly payment that can be tolerated).

Set the “By Changing Cell” to the Amount Borrowed in cell B7 (currently $0.00).

Click Solve and let Goal Seek find your solution.

The algorithm will churn through the possible solutions until it settles on one that satisfies your tolerance (accuracy) setting.

In this case, the maximum amount you could borrow is $296,041.75.

### Retirement Calculation Example

Suppose you want to retire with a pot of $1.5m in 40 years time. You’re confident of getting a 5% return on your investments.

What’s the annual contribution you need to make each year to hit this target?

Let’s use Goal Seek to find out.

Firstly, setup the sheet with the known variables in your Sheet:

The calculation of the retirement pot value uses the Future Value function, the FV function, in Google Sheets in cell B7:

`= FV( B5 , B4 , -B6 , 0 , 0 )`

In Goal Seek, set the “Set Cell” to be this equation in cell B7.

Set the “To Value” to $1,500,000 (your target retirement pot).

Set the “By Changing Cell” to the Annual Contribution in cell B6 (currently $0.00).

Click Solve and let Goal Seek find your solution.

In this case, you need to contribute $12,417 each year to hit your retirement pot target of $1.5m.

Click here to open a Google Sheet template with all the examples from this tutorial >>

*(Feel free to make your own copy: File > Make a copy…*

*If the file won’t open without permission, please open in an incognito window and copy from there.)*

## Resources

Google Documentation on the Goal Seek feature.

Great explanations, thank you Ben!

Thank you for the explanation! I recently found this feature in MS Excel and have been using it extensively ever since. It’s great to see that this tool was implemented in Google Sheets as well!

Did you find it to be much quicker in excel than google sheets as i did? I found that it was unworkable on Google sheets as it was so slow

Just want to note that the FV formula in your screenshot is correct but the text is different. Thank you for this guide!

Good spot! I’ve fixed that now. Thank you.

Finally! Still waiting for ‘What If Data Table’ of excel to be available here.

That would be nice! In the meantime, there is a third-party what-if analysis add-on: https://chrome.google.com/webstore/detail/what-if-analysis/plbdmkgogobniebdohfickjndnechhel

I need something similar, but what I want it to do is make the breakeven price change. I farm and sell grain. Sometimes it may be 1500 bushel at $4.00 and the next sale may be 900 bushel at $3.83. What I have setup is all my inputs divided into what I expect to sell all the grain for. That gives me a constant break even. I’d like that breakeven number to change up or down as I go along with my sales where the price and the amount may be different for each sale until 100% is sold. Do you know of any add on or formula that would do this?

Hi,

Is there a ready made script for a goal seek function in Google sheets which automatically find values on change with out using add-on feature.

Thanks and Best Regards,

RASHID MAHMOOD

The post is very helpful for me. Thank you very much

This would have been good, but the add on has an error which prevents its use.

Can you set the goal seek to achieve a maximum or minimum value? I have an equation that calculates a dollar value based on the inputs, but I do not know what the max value is per scenario. Currently, get an error because I set a very high target. The answer is correct, except that it would be nice to avoid the error.

Thank you so very much for this tutorial. I have the same question as Joe Doyle. How do you calculate the max possible value for a set of variable? In your example, we could consider a budget of $100k for the conf. Each speaker brings x additional attendees, there are choices of room sizes and depending on the price of the ticker more or less attendees will join. Is there a way to maximize the value of the profit by finding the optimal combination of variables (conf. price, room size, #of speaker)?

Thx for giving multiple examples that are not sales figures related.

Is there a way to call the GoalSeek function in apps script? This is something that I have done using Excel / VBA in the past