Excel has no built-in command that symbolically solves every polynomial, but you can find real roots with the Solver add-in: calculate the polynomial in a worksheet, minimize its squared value, and let Solver change the input cell. For a polynomial with several real roots, repeat the process from different starting guesses; each run may find a different root.
What a polynomial solver in Excel can do
A polynomial is an expression such as ax² + bx + c, or a higher-degree expression such as x³ − 6x² + 11x − 6. A root is an x-value that makes the expression equal zero. Excel can calculate a polynomial for any supplied x-value, and its Solver add-in can search numerically for x-values that make the result zero.
The distinction between numerical and symbolic solving matters. A symbolic solver might return an exact expression or prove that no real roots exist. Solver instead tries values and improves them according to a numerical method. It can provide a useful decimal approximation, but it does not generally give a proof that it found every root.
For a simple quadratic, the quadratic formula can be faster and more transparent than Solver. For higher-degree equations, polynomials with multiple roots, or equations embedded in a larger spreadsheet model, Solver may be a practical option. Excel can search for real-valued roots; it is not a general-purpose complex polynomial root finder.
How Excel represents the polynomial
Set up the expression in cells so the value can be recalculated whenever the trial value of x changes. For example, put x in B1 and the coefficients of x³ − 6x² + 11x − 6 in A2:A5, in descending-power order: 1, −6, 11, and −6. In B2, calculate the polynomial using this layout:
With coefficients in A2:A5 and the trial value x in B1, enter this formula in B2: =A2*B1^3+A3*B1^2+A4*B1+A5. At B1 = 1.2, B2 returns 0.288: 1.2³ − 6(1.2²) + 11(1.2) − 6 = 0.288.
Then make an objective cell that measures how far the result is from zero. With the polynomial value in B2, enter this in B3: =B2^2. At x = 1.2, B3 returns 0.082944, since 0.288² = 0.082944. A zero in B3 means the polynomial value in B2 is zero; a small positive value indicates a near-root, subject to rounding and the scale of the expression.
For a polynomial of a different degree, adapt the powers and coefficients in B2. Keep the coefficient order consistent, and do not omit zero coefficients. For example, x³ + 2x − 5 has a zero coefficient for x², so its coefficient list is 1, 0, 2, −5. Leaving that zero out would shift the remaining coefficients to the wrong powers.
Enable and run Solver in Microsoft Excel
In Excel for Microsoft 365 on Windows, Solver is an Excel add-in. If it is not already available, enable it by selecting File > Options > Add-ins. At the bottom, choose Excel Add-ins in the Manage box, select Go, check Solver Add-in, and select OK. Solver should then appear on the Data tab. The exact labels may vary slightly with updates or display settings.
To search for a root in the example worksheet:
- Put a trial value, such as 1.2, in B1. Confirm that B2 calculates the polynomial and B3 calculates its square.
- Select Data > Solver. Set Objective to B3, choose Min, and set By Changing Variable Cells to B1.
- Choose GRG Nonlinear as the solving method. The polynomial contains powers of a changing cell, so it is nonlinear.
- Select Solve. Review the result and choose Keep Solver Solution if it is useful. Check B2 as well as B3: a root should make B2 close to zero.
Minimizing the square is a convenient way to make zero the best possible objective value, but Solver is still doing numerical optimization, not symbolic algebra. A nonzero result means the search did not reach a root closely enough, or it may have stopped at a local minimum. You can change the starting value in B1 and run Solver again.
On Excel for Mac, enable the add-in from Tools > Excel Add-ins, select Solver Add-in, and then look for Solver on the Data tab. Excel for the web does not provide the desktop Solver add-in in the same way; open the workbook in the desktop app to use these steps. If your organization manages add-ins centrally, its settings may affect availability.
Find a quadratic root with a formula
For ax² + bx + c = 0, the quadratic formula gives x = (−b ± √(b² − 4ac)) / (2a), provided a is not zero. It can give both real roots in a worksheet without iterative Solver settings. For an example, put a in A2, b in B2, and c in C2, using 1, −5, and 6. The polynomial is x² − 5x + 6, whose roots are 2 and 3.
With a, b, and c in A2, B2, and C2 respectively, enter this formula in D2 for the root using the plus sign: =(-B2+SQRT(B2^2-4*A2*C2))/(2*A2). It returns 3 for the example. With the same coefficient layout, enter this in D3 for the root using the minus sign: =(-B2-SQRT(B2^2-4*A2*C2))/(2*A2). It returns 2.
The expression under the square root, b² − 4ac, is the discriminant. If it is positive, the quadratic has two distinct real roots; if it is zero, it has one repeated real root; if it is negative, the roots are complex rather than real. Excel’s SQRT function returns an error for a negative real input, so those formulas are not a complex-root solution. Also check that a is not zero, because then the equation is linear and the quadratic formula divides by zero.
Why one run may not find every root
Solver searches from the starting value you supply. A polynomial can cross zero several times, so different starting values can lead to different roots. The example x³ − 6x² + 11x − 6 has roots 1, 2, and 3. A successful run from a starting point near 1 may find the first root, while a run started near 3 may find the last one. One result is not evidence that the polynomial has only one root.
Try a spread of initial values across a reasonable range, record each converged result, and compare them after rounding to a suitable number of decimal places. Repeated runs may return the same root, and a numerical method may miss a root if the starting values are poorly chosen. A repeated root can be especially difficult: the expression may touch zero without crossing it, and its slope is also zero at the root.
For a first estimate, make a table of trial x-values and corresponding polynomial values, or plot them in an XY scatter chart. Where the curve crosses the horizontal axis, a real root lies between nearby x-values. A chart is a visual aid, not a precision result, but it helps choose starting values and spot roots a Solver run may have missed.
Accuracy, scaling, and common Solver problems
Numerical results are approximate. Solver may report a value such as 1.0001 rather than exactly 1, and the polynomial evaluated at that value may be a small nonzero number. Judge the result by the residual in B2, not just by the number of displayed decimal places in B1. Formatting a cell to show fewer decimals changes its display, not the stored value or the accuracy of the calculation.
Scale can affect the search. A polynomial whose terms or coefficients are extremely large or small may be harder to optimize than a similar expression with values near ordinary magnitudes. If Solver behaves erratically, check the coefficient references and signs, verify the formula at a few hand-calculated x-values, and consider rescaling the equation by dividing every coefficient by the same nonzero number. This does not change its roots, although it changes the residual’s magnitude.
Common issues to check include:
- Wrong coefficient order: Confirm that each coefficient multiplies the intended power of x.
- Wrong objective: Solver should change the x cell and target the polynomial’s squared value, not a fixed value or unrelated cell.
- Starting point too distant: Try a closer value based on a table or graph, then run again.
- Apparent solution is not close enough: Inspect the residual and adjust Solver’s precision settings only if you understand the trade-off. A tighter setting does not guarantee that Solver finds every root.
- Complex roots: A search over real x-values cannot return a non-real root. Use a method or software that supports complex numbers if those roots are required.
Choosing between Solver, Goal Seek, and other tools
Solver is suited to a changing input cell when the objective is nonlinear, when you want to add constraints, or when the polynomial is part of a larger model. Goal Seek is a simpler built-in option for changing one input cell until a formula reaches a specified value. In desktop Excel, find it at Data > What-If Analysis > Goal Seek. Set the polynomial cell as the Set cell, set To value to 0, and choose the x cell as By changing cell. Goal Seek is convenient for a single attempt, but it also does not enumerate all roots or guarantee the nearest result you might expect.
For a quadratic, the direct formula avoids iterative searching and returns both real roots when the discriminant permits. For cubics and higher degrees, Excel worksheets can still calculate trial values and use Solver, but specialized numerical or computer algebra software may be preferable when you need all roots, complex roots, high precision, or reproducible root-finding procedures. A plotted table can help explore behavior, but visual inspection alone is not a substitute for checking the residual.
Choose based on the question you need answered. If you need one approximate real root, Solver or Goal Seek may be enough. If you need every root, document the initial guesses and validate each result, or use a tool designed to enumerate polynomial roots. If the equation is part of a business or engineering model, keep the coefficient cells, assumptions, and Solver settings visible so another reader can audit the calculation.
Frequently Asked Questions
Does Excel have a built-in polynomial root function?
No. Standard Excel does not include a general function that returns all roots of an arbitrary polynomial. You can use the quadratic formula for second-degree equations, or use Solver or Goal Seek to search numerically for a real root.
Can Excel Solver find all roots?
Not in one run. Solver searches from a starting point and typically returns one solution. Repeating the search with different starting values may reveal other roots, but it does not guarantee that every real or complex root has been found.
Why does Solver return a different root each time?
A polynomial can have multiple roots, and Solver’s result depends partly on the initial x-value and the numerical search. Different starting values can lead to different valid roots, while some runs may stop short or fail to converge.
Can I solve a polynomial with complex roots in Excel?
The Solver procedure described here varies a real worksheet cell, so it searches for real roots only. The quadratic formula using SQRT also gives an error when its discriminant is negative. Use software with complex-number polynomial root support when complex roots are needed.
Is Goal Seek better than Solver for polynomial equations?
For a basic equation with one changing x-value and a target of zero, Goal Seek is simpler to set up. Solver offers more control and can work with constraints or a broader optimization model. Neither tool automatically finds or proves all polynomial roots.
Related
- Import Multiple CSV Files into Excel: Fast Methods
- How to Import CSV to Excel: Steps and Common Fixes
- PKSolver in Excel: What It Does and How to Use It Safely
Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.
More in How-to basics
- Compress Photos in PowerPoint to Reduce File SizeTo compress photos in PowerPoint for Microsoft 365 on Windows, select a picture, go to Picture Format >…
- Add Percentages to an Excel PivotTableTo add a percentage to an Excel PivotTable, put the value field in the Values area a second…
- Password Protect Multiple Excel Files at Once in ExcelYes. In Excel for Microsoft 365 on Windows, you can password-protect multiple workbooks by running a VBA macro…
- QuickBooks Excel and CSV Import Toolkit: What It DoesThe QuickBooks Excel and CSV Import Toolkit is an Intuit support resource for bringing certain list data from…
- Consolidate CSV Files in One Excel WorkbookYes. In Excel for Microsoft 365 on Windows, use Power Query to combine multiple CSV files into one…
- Making a Schedule in Excel: A Practical Step-by-Step GuideTo make a schedule in Excel, set up a grid with days or dates across the top and…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.