What-if analysis

Find the input that reaches a target with Goal Seek, tabulate results with data tables, compare scenarios, forecast a series, and optimise a model with Solver.

What-if tools change the inputs of a model and look at what happens to its results. They are in the Forecast and Analysis groups on the Data tab.

Goal Seek and Solver calculate first and show you the answer; nothing on the sheet changes until you accept it, and accepting is one undo step.

Goal Seek

Goal Seek works backwards: it finds the value of one input cell that makes a formula reach the number you want. For example, the price that makes profit reach 10,000.

  1. Click the cell with the formula — it fills in the first field.
  2. Click Data › Forecast › Goal seek….
  3. Fill in the Goal seek dialog:
FieldWhat to type
Set cellThe cell with the formula, such as B7
To valueThe number the formula should reach
By changing cellThe input cell to change, such as B2. It must hold a number, not a formula.
  1. Click Find. The answer appears in the dialog, for example B7 reaches 10000 when B2 is 12.5, found in 9 recalculations.
  2. Click Apply to write the answer into the input cell, or change the fields and click Find again. Apply is available only when Goal Seek found an answer.

The status bar confirms the change, for example B2 set to 12.5.

If Goal Seek can’t find an answer, the dialog says why:

MessageWhat to do
”…” is not a cell reference.Type a single cell address.
”…” is not a number.Type a number in To value.
The cell to change is the same as the cell to set.Choose a different input cell.
cell holds a value, not a formula, so there is nothing to solve.Set cell must hold a formula.
cell holds a formula. Goal Seek can only change a cell you type a number into.Choose an input cell that holds a number.
cell does not produce a number when input is value**.**The formula gives an error or text for that input. Check the model.
cell does not change when input does, so no value of input can reach target**.**The formula doesn’t depend on that input.
Stopped after n recalculations at value**, which is** difference away from target**.**The target may be out of reach. Try a different target.

Data tables

A data table recalculates one or two formulas for a list of input values and writes the results in a grid — a loan payment for five interest rates, say, or for every combination of rate and term.

Lay out the table

The table is a rectangle on the sheet. Its top row and left column are its edges; the cells inside are filled with results.

KindTop rowLeft columnTop-left corner
One input, values down the sideFormulas, from the second cellInput values, from the second cellNot used
One input, values across the topInput values, from the second cellFormulas, from the second cellNot used
Two inputsValues for the row input cellValues for the column input cellThe formula

The formulas must refer, directly or through other cells, to the input cell the values will be put into. The input cells themselves must be outside the table.

Fill the table

  1. Select the whole rectangle, edges included.
  2. Click Data › Forecast › Data table….
  3. In Data table:
    • Row input cell — the cell the values in the top row are put into. Leave it blank for a table with values down the side.
    • Column input cell — the cell the values in the left column are put into. Leave it blank for a table with values across the top.
  4. Click Fill.

For each input value, the input cell is set, the formulas are recalculated and their results written into the table. Afterwards the input cells are put back as they were. The status bar says, for example, Filled 25 cells from two inputs. The results are numbers, not a live table — run it again after changing the model.

MessageWhat to do
A data table needs at least two rows and two columns: one edge for the inputs and one for the results.Select a bigger rectangle.
No input cell was given.Fill in at least one input cell.
cell is inside the table. An input cell has to sit outside it, or filling the table would overwrite the input.Move the input cell, or select a different rectangle.
cell holds a formula. An input cell has to be one you type a number into.Choose an input cell that holds a number.
A two-input table takes its formula from corner**, which holds a value rather than a formula.**Put the formula in the top-left corner.
The top row of the table holds no formulas, and the left column holds no numbers.For a column input cell, put formulas across the top and values down the side.
The left column of the table holds no formulas, and the top row holds no numbers.For a row input cell, put formulas down the side and values across the top.
None of the edge cells hold numbers to substitute.Type input values along the edges.

Scenarios

A scenario is a named set of values for the same input cells — Best case, Worst case, Budget. You can switch the sheet between scenarios, and write a summary that compares their results side by side.

Add a scenario

  1. Type the values for the scenario into the input cells.
  2. Select the input cells — up to 32 cells, none holding a formula.
  3. Click Data › Forecast › Scenarios…. Once the sheet has scenarios, the button shows how many, such as 3 scenarios.
  4. In Scenarios, type a name in the box labelled Add the selection followed by its address and as — for example Best case.
  5. Click Add.

The status bar says, for example, “Best case” saved, changing 3 cells. Adding a scenario with a name that already exists replaces it (“Best case” updated.). To add another, close the dialog, change the input values, select the cells and add again.

MessageWhat to do
A scenario needs a name.Type a name.
No changing cells were given.Select the input cells before opening the dialog.
A scenario can change at most 32 cells; n were selected.Select fewer cells.
cell holds a formula. A scenario can only change cells you type values into — applying one would replace the formula with a number, and there would be no way back.Leave formula cells out of the selection.

Show a scenario

  1. Click Data › Forecast › Scenarios….
  2. Click Show beside the scenario.

Its values are written into its cells and every formula recalculates. The status bar says Showing followed by the scenario’s name. Showing a scenario is one undo step. The list shows each scenario’s cells and values under its name.

To delete a scenario, click the bin beside it (Delete followed by its name).

Summarise the scenarios

  1. Click Data › Forecast › Scenarios….
  2. In Result cells for the summary, type the cells whose results you want to compare, such as B7 or B7:B9. It starts as the current cell.
  3. Click Summary. It is available once the sheet has at least one scenario.

A new sheet called Scenario Summary is added and shown. It has a column for Current values — what the sheet held when you made the report — and a column for each scenario, with rows for the Changing cells: and the Result cells:. A note at the bottom says the report is numbers, not live. The sheet you started from is left as it was. The status bar says Summary written to “Scenario Summary”.

Scenarios are saved in the workbook in the format Excel uses.

Forecast Sheet

Forecast Sheet continues a history of values into the future — next year’s monthly sales from the last three years, say — and draws the forecast with a prediction interval that widens the further ahead it goes.

  1. Select the two columns: the timeline on the left (dates or numbers, evenly spaced) and the values beside it. Leave out the headings.
  2. Click Data › Forecast › Forecast….
  3. Check the fields in Forecast sheet:
FieldWhat it does
TimelineThe dates or numbers, such as A2:A37. Filled in from the first column of the selection.
ValuesThe values, such as B2:B37, the same length as the timeline
Periods aheadHow many periods to forecast. Leave it blank to forecast about a third of the history, or one full season if that is longer.
80%, 90%, 95%, 99%How sure the prediction interval should be. 95% is chosen to start.
Show the intervalAdds the lower and upper bounds. On to start.
  1. Click Create.

A new sheet called Forecast is added and shown. It has columns for Timeline, Values, Forecast, Lower bound and Upper bound, and a line chart of all of them titled with the interval, such as 95% prediction interval. The last historical value is repeated in the forecast columns so the lines join.

The forecast uses exponential triple smoothing: the level, the trend and any repeating pattern are fitted to the history. The status bar describes what was found — for example 12 periods forecast on “Forecast”. Found a repeating pattern 12 points long, 2 missing points filled in. MASE 0.41 — better than assuming nothing changes. MASE compares the model’s error with the error of assuming nothing changes from one period to the next; below 1 means the model does better.

Missing values in the history are filled in, and values that share a timestamp are averaged.

MessageWhat to do
”…” is not a range.Type a range such as A2:A37.
”…” is not a whole number.Type a whole number in Periods ahead, or leave it blank.
The timeline holds n cells and the values m**. They have to line up.**Make both ranges the same length.
Every cell of the timeline has to hold a date or a number.Remove headings and text from the timeline.
A forecast needs at least two points with different timestamps.Include more history.
The timeline does not move forward.Sort the data by the timeline first.
The timeline is not evenly spaced: … or The timeline has gaps in it.Use a timeline with a regular step, such as one row per month.
There is not enough history to fit a forecast to. Three points is the minimum, and a seasonal pattern needs two full cycles.Include more history.
Ask for at least one period.Type 1 or more in Periods ahead.

The FORECAST.ETS, FORECAST.ETS.CONFINT, FORECAST.ETS.SEASONALITY and FORECAST.ETS.STAT functions use the same model in a formula. See the Function reference.

Solver

Solver finds the values of several input cells that make a formula as large or as small as possible, or reach a target, while keeping to limits you set — the product mix that maximises profit within a budget, say.

  1. Click the cell with the formula to optimise — it fills in the first field.
  2. Click Data › Analysis › Solver….
  3. Fill in the Solver dialog:
FieldWhat to type
Objective cellThe cell with the formula to optimise
Max, Min, Value ofWhether to make the objective as large as possible, as small as possible, or equal to Value
By changing cellsThe input cells Solver may change, as one range such as B2:B5. They must hold numbers, not formulas.
SUBJECT TOThe constraints, one per row (see below)
Unconstrained variables are non-negativeOn: changing cells without their own lower limit stay at zero or above. On to start.
  1. Click Solve. The result appears in the dialog: a sentence about what was found, and the value Solver chose for each changing cell.
  2. Click Keep solution to write those values into the sheet, or change the model and click Solve again. Click Cancel to leave the sheet as it was.

The status bar confirms how many cells were updated.

Constraints

Each constraint row has a range on the left, a relation, and — except for int and bin — a right-hand side.

RelationMeans
<=The left side must be at most the right side
>=The left side must be at least the right side
=The left side must equal the right side
intThe cells must be whole numbers
binThe cells must be 0 or 1

The right-hand side can be a number (100), a range the same size as the left side (D2:D5, compared cell by cell), or a formula (=SUM(C2:C5)/2). Click Add constraint for another row, and × (Remove this constraint) to delete one. Rows with an empty left side are ignored.

What Solver’s answer means

Solver searches for the best values directly, trying steps in each direction, which suits models full of IF, ROUND and lookups. The answer is the best point the search reached, not a proven optimum, and whole-number constraints are searched rather than proved. The same model gives the same answer each time. The dialog says this in a note under the fields.

Result sentences you may see:

ResultMeaning
Found a maximum of value after n recalculations. This is the best point the search reached, not a proven optimum.Solver finished and every constraint holds.
Found a minimum of …As above, for Min.
Reached target after n recalculations.Value of: the target was reached.
The closest the objective came to target was value**, after** n recalculations.Value of: the target wasn’t reached.
One constraint could not be met: … The model may have no solution, or the search may have stopped in the wrong region — try different starting values.Change the starting values in the changing cells and solve again, or check the constraints.

Problems with the model are shown in red:

MessageWhat to do
”…” is not a cell reference. or ”…” is not a range.Type a cell or range address.
No cells were given to change.Fill in By changing cells.
cell holds a value, not a formula, so changing the other cells cannot move it.The objective must be a formula.
cell is both the objective and a cell to change.Remove the objective from the changing cells.
cell holds a formula. The solver can only change cells you type numbers into.Remove formula cells from By changing cells.
cell is marked int (or bin) but is not one of the cells the solver may change.Apply int and bin only to changing cells.
… the two sides are different sizes — n cells against m**.**Make the right-hand range the same size as the left.
… the right-hand side is empty.Type a right-hand side.
… is not a number. or … the right-hand side does not come to a number.Correct the right-hand side.
The bounds on one of the cells contradict each other: it must be at least low and at most high**.**Correct the constraints.
The objective or one of the constrained cells does not produce a number at the starting values.Fix errors in the model, or change the starting values.

Something unclear or out of date on this page? Tell us.