Excel Goal Seek Integer? How to Get Whole-Number Results

How-to basics · Updated November 19, 2026

No. Excel Goal Seek does not have an integer constraint, so its changing cell can end up with a decimal value. If the input must be a whole number, use Solver with an integer constraint, or check whole-number candidates yourself and compare their results.

What Goal Seek does

Goal Seek is a what-if analysis tool for finding an input that makes a formula return a value you specify. You provide three things: a formula cell, the target result, and one input cell that Excel may change. Excel then adjusts that input iteratively until the formula is sufficiently close to the target or it cannot find a suitable solution.

In Excel for Microsoft 365 on Windows, open Data > What-If Analysis > Goal Seek. In the dialog, enter the formula cell in Set cell, the desired result in To value, and the input cell in By changing cell. The set cell must contain a formula, and the changing cell must be one cell rather than a range. Excel for Mac has Goal Seek under the Data tab’s What-If Analysis options; labels or ribbon layout can vary slightly by release. Goal Seek is not available in Excel for the web, so open the workbook in the desktop app to use it.

For example, a formula might calculate a product’s revenue from its unit price and quantity, or calculate a loan payment from an interest rate. Goal Seek can adjust one of those inputs to reach a chosen result. It does not decide whether the answer makes business sense, whether another solution exists, or whether the input should be an integer.

Why the changing cell can be decimal

Goal Seek treats the changing cell as a numeric input and searches for a value that satisfies the formula. It has no setting such as “whole number only,” and it does not round the changing cell to an integer automatically. A result such as 7.071 is therefore valid from Goal Seek’s perspective, even if a real-world decision must use seven or eight items.

Consider a worksheet with a trial input in B2 and a formula result in B3. With the input value in B2 and the formula =B2^2 in B3, asking Goal Seek to make B3 equal 50 gives a mathematical input near 7.071, because 7.071 squared is approximately 50. The exact roots are the positive and negative square roots of 50. If B2 starts positive, Goal Seek will generally search near that starting value; starting at a negative value can lead it toward the negative root. This is one reason the starting value matters.

If the input represents a count of machines, people, boxes, or shifts, a fractional answer is usually not usable. The correct whole-number choice also depends on the goal. If the objective is to meet or exceed a target, rounding upward may be appropriate; if it is to stay under a limit, rounding downward may be safer. Neither choice is automatic, and rounding the displayed number is not the same as changing the underlying input.

Run Goal Seek and inspect the result

Use Goal Seek when you want a quick answer for a formula that depends on one adjustable input. Before running it, make sure the formula cell calculates correctly and the changing cell is the input you actually want Excel to alter. Keep a note of the original input if you need to restore it after the what-if calculation.

  1. Select Data > What-If Analysis > Goal Seek.
  2. For Set cell, select the cell containing the formula you want to control.
  3. For To value, type the desired numeric result.
  4. For By changing cell, select the single input cell Goal Seek may adjust.
  5. Choose OK, review the result, and decide whether to keep it or restore the original values.

Goal Seek may report that it found a solution, but that does not mean the input is an integer or that the target is exactly attainable. It works by numerical iteration and may stop when it reaches an acceptable approximation. Check the actual formula result and the changing-cell value after it finishes. If the target is a strict requirement, verify the remaining difference rather than relying only on the dialog’s success message.

How to choose a whole-number answer

For a simple problem, compare the nearest integers on either side of Goal Seek’s decimal result. In the square example, the nearest candidates are 7 and 8. With B2 holding the candidate and B3 containing =B2^2, entering 7 produces 49, while entering 8 produces 64. The target of 50 cannot be reached exactly by an integer input. If the requirement is to get as close as possible, 7 is closer: its gap is 1, compared with a gap of 14 for 8. If the requirement is to meet or exceed 50, 8 is the first acceptable whole-number input.

For a formula that increases steadily as the input increases, checking the floor and ceiling of Goal Seek’s result is often enough to identify the closest candidates. Do not assume that rule works for every model. A formula may rise and fall, jump in steps, or have multiple solutions. In those cases, compare the relevant integer choices directly and check the actual business condition, such as minimum capacity or maximum cost.

For a small range, an Excel data table or a simple list of candidate inputs can make the comparison transparent. Enter each plausible integer in a separate row and calculate the formula output for each one. This is often easier to audit than rounding an answer and assuming the rounded value still satisfies the requirement. For a large range or a model with several changing cells, Solver is usually a better fit.

Use Solver when integer values are required

Solver is an Excel add-in that can optimize an objective while applying constraints, including integer constraints. If Solver is missing on Windows, enable it through File > Options > Add-ins. At the bottom, choose Excel Add-ins beside Manage, select Go, and check Solver Add-in. Solver then appears on the Data tab. On Mac, Solver can be enabled through Tools > Excel Add-ins in supported desktop versions.

In Solver, set an objective cell to maximize, minimize, or reach a specified value; choose the changing cells; and add constraints. To require a whole number, add a constraint for the relevant changing cell and select int as its relation. You can add other limits at the same time, such as a budget ceiling, a minimum production level, or a nonnegative requirement. Choose a solving method suitable for the model: Simplex LP is intended for linear models, while nonlinear or discontinuous models may need another Solver method. Integer restrictions can make a problem harder to solve, and a result should still be checked against the worksheet and the real requirements.

For a small linear example, suppose A2 is the number of units and B2 contains =7*A2, so each unit contributes seven points. To maximize B2 without exceeding 50 points, set B2 as the Solver objective to maximize, make A2 the changing cell, and add constraints A2 is int, A2 is greater than or equal to 0, and B2 is less than or equal to 50. The best result is A2 = 7 and B2 = 49. Eight units would produce 56 and violate the limit. This example shows why an integer constraint is more reliable than asking Goal Seek for 50 and rounding its answer.

Why rounding the Goal Seek cell can mislead

It is tempting to wrap the changing input in a rounding formula or to round the answer shown in the cell. These approaches do not add an integer constraint to Goal Seek. If a separate input cell is used in a formula such as =ROUND(B2,0)^2, Goal Seek is adjusting B2 while the formula output changes in steps. That makes the relationship discontinuous: many nearby decimal inputs produce the same rounded value, and the target may not be reachable. Goal Seek can stall, return an unhelpful input, or fail to identify the best whole-number choice.

Similarly, formatting a cell to show zero decimal places changes only its display; it does not change the stored value. A value of 7.071 may appear as 7 while calculations still use 7.071. A formula that rounds a result can be useful when rounding is genuinely part of the model, but it is not a substitute for constraining the decision variable. Use Solver for a modeled integer decision or explicitly evaluate candidate integers.

Common issues and checks

  • Wrong set cell: Goal Seek needs the formula cell whose result should change, not the input cell. Confirm that the selected formula refers to the changing cell.
  • More than one input needs adjustment: Goal Seek changes only one cell. Use Solver when the model needs multiple decision variables.
  • No exact solution exists: A discrete input may skip over the target. Decide whether the requirement is to equal, exceed, stay below, or get as close as possible to the target.
  • Different answers from different starting values: Nonlinear formulas can have multiple solutions. Try a sensible starting value and check whether the answer fits the intended range.
  • Displayed answer looks integral: Increase the displayed decimal places or inspect the formula bar. Number formatting does not enforce whole numbers.
  • Solver’s answer seems unexpected: Check every constraint, the objective direction, and whether the model is linear. Recalculate the worksheet and verify the result manually against nearby integer choices.

Goal Seek, Solver, or a candidate table?

Use Goal Seek when there is one adjustable input, a formula target, and a fractional answer is acceptable or can be evaluated afterward. Use Solver when the input must be an integer, when several inputs can change, or when the problem includes limits that must all hold at once. Use a candidate table when there are only a few plausible whole-number values and you want to see every result side by side.

These tools answer different questions. Goal Seek asks, “What input makes this formula reach the target?” Solver asks, “What permitted input or combination of inputs optimizes this objective under these rules?” A candidate table asks, “What happens for each of these options?” Choosing the method that matches the decision prevents a decimal approximation from being mistaken for a valid integer solution.

Frequently Asked Questions

Can Goal Seek return a whole number?
Yes, it can happen to return an integer, but Goal Seek does not require one. If the result must always be an integer, use Solver’s integer constraint or evaluate integer candidates explicitly.

Can I round the Goal Seek result to the nearest integer?
You can, but the rounded input may no longer produce the target. Recalculate the formula with that integer and check whether it meets the actual requirement; compare the adjacent integer too when closeness matters.

How do I make a cell accept only whole numbers?
Data validation can restrict values entered by a user, but it is not the same as an optimization constraint for Goal Seek. For a decision variable that Solver must keep integral, add Solver’s int constraint.

Can Goal Seek change more than one cell?
No. Goal Seek adjusts one changing cell at a time. Solver is designed for models with multiple changing cells and can apply constraints to them.

Why does Goal Seek say it found a solution when the number is decimal?
Its success message means it found a numerical input that makes the formula sufficiently close to the target. It does not mean the input meets an integer or other real-world constraint unless you verify that separately.

Related

Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.

More in How-to basics

Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources

Spotted an error in this guide? Let us know.