Excel Quadratic Equations: How to Solve Them with Formulas

Formulas & functions · Updated November 21, 2026

Yes. Excel can solve a quadratic equation by calculating its roots with the quadratic formula, or by using Goal Seek to find one root at a time. For an equation written as ax² + bx + c = 0, the formula-based method is usually the quickest and gives both roots when they are real.

What it means to solve a quadratic in Excel

A quadratic equation has the form ax² + bx + c = 0, where a, b, and c are numbers and a cannot equal zero. The solutions, also called roots, are the values of x that make the left side equal zero. Excel does not have a single built-in function that accepts a, b, and c and returns both roots. Instead, you can enter the standard quadratic formula in worksheet cells, or use a numerical tool such as Goal Seek.

The exact formula is x = (-b ± √(b² – 4ac)) / (2a). The expression under the square root, b² – 4ac, is called the discriminant. Its value tells you what kind of roots to expect:

  • If the discriminant is positive, there are two distinct real roots.
  • If it is zero, there is one repeated real root.
  • If it is negative, the roots are a complex conjugate pair, not real numbers.

This distinction matters in Excel because the SQRT function returns an error for a negative real input. A #NUM! result can therefore indicate that the equation has no real roots, rather than a mistake in the coefficients.

Calculate both roots with the quadratic formula

For ordinary real roots, enter the coefficients in separate cells and use one formula for each sign. The following example assumes a is in B1, b is in B2, and c is in B3. Put the plus-sign root in B5 with =(-B2+SQRT(B2^2-4*B1*B3))/(2*B1). Put the minus-sign root in B6 with =(-B2-SQRT(B2^2-4*B1*B3))/(2*B1).

Both expressions follow the same equation; the only difference is the sign before the square root. Excel uses the caret for exponentiation, so B2^2 means b squared. Multiplication signs are explicit, and parentheses keep the numerator and denominator grouped correctly. If a is zero, the equation is linear rather than quadratic, and these formulas divide by zero. Check that B1 is not zero before using them.

With Microsoft 365 for Windows, enter the coefficients and formulas in the cells described above, then press Enter. Excel recalculates the roots when a coefficient changes. You can label the cells beside the answers as plus root and minus root so it is clear which result comes from each branch of the formula. The same worksheet formulas work in Excel for Mac; menus and some interface details may differ, but the formula syntax is the same.

Check the discriminant before interpreting an answer

It can be useful to display the discriminant in its own cell. With a in B1, b in B2, and c in B3, enter =B2^2-4*B1*B3 in B4. A positive result means both SQRT-based formulas should return real numbers. A zero result means the two formulas return the same value. A negative result means the ordinary real-number formulas produce #NUM! because Excel cannot take the real square root of a negative number.

For example, if the discriminant is 9, its square root is 3; the two numerators differ by 6, so the resulting roots are generally different. If the discriminant is 0, adding or subtracting its square root changes nothing, so both formulas give -b/(2a). This is a useful way to distinguish a repeated root from two separate answers without relying on how many decimal places Excel displays.

Use Goal Seek to find one root

Goal Seek is an alternative when you already have a worksheet expression for the equation and want Excel to adjust an input until the expression equals zero. It is a numerical method: it searches from a starting value and returns a solution it can reach. It does not automatically report both roots, and the starting value can affect which root it finds.

For a setup with a in B1, b in B2, c in B3, a trial value of x in B4, and the equation result in B5, enter =B1*B4^2+B2*B4+B3 in B5. Then follow these steps in Excel for Microsoft 365 on Windows:

  1. Enter an initial guess for x in B4.
  2. Select Data > What-If Analysis > Goal Seek.
  3. Set Set cell to B5, To value to 0, and By changing cell to B4.
  4. Select OK and review the proposed value and the resulting value in B5.

Goal Seek changes only the chosen input cell to make the formula cell approach the target. Excel for Mac also includes Goal Seek, though its location or wording can vary slightly by release. Excel for the web may not expose the same What-If Analysis tools; if Goal Seek is unavailable, use the quadratic-formula cells or open the workbook in desktop Excel. Goal Seek is handy for a larger model, but for a single quadratic the explicit formula is more direct and reveals both roots at once.

Worked example: x² – 5x + 6 = 0

Here a = 1, b = -5, and c = 6. With a in B1, b in B2, and c in B3, enter 1 in B1, -5 in B2, and 6 in B3. The discriminant formula =B2^2-4*B1*B3 returns 1, because 25 – 24 = 1. The square root is therefore 1.

With the same coefficient layout, the plus-sign formula =(-B2+SQRT(B2^2-4*B1*B3))/(2*B1) returns 3, and the minus-sign formula =(-B2-SQRT(B2^2-4*B1*B3))/(2*B1) returns 2. The arithmetic is (-(-5) + 1)/2 = 3 and (-(-5) – 1)/2 = 2.

You can verify either answer by substituting it back into the original equation. With a in B1, b in B2, c in B3, and a candidate root in B5, enter =B1*B5^2+B2*B5+B3 in B6. For B5 equal to 2, the result is 4 – 10 + 6 = 0; for B5 equal to 3, it is 9 – 15 + 6 = 0. A result close to zero can also be valid when calculations involve decimal rounding.

Complex roots and other edge cases

When the discriminant is negative, the equation still has two solutions over the complex numbers, even though it has no real-number roots. For instance, x² + 2x + 5 = 0 has discriminant 4 – 20 = -16, so its roots are -1 + 2i and -1 – 2i. Excel’s SQRT formula for real numbers returns #NUM! in this case. That error does not mean the original equation is invalid; it means the chosen formula is working in the real numbers.

Excel also provides complex-number functions such as COMPLEX, IMSQRT, IMSUM, IMSUB, and IMDIV. With a in B1, b in B2, and c in B3, the complex plus-root formula is =IMDIV(IMSUM(COMPLEX(-B2,0),IMSQRT(COMPLEX(B2^2-4*B1*B3,0))),COMPLEX(2*B1,0)). For the minus-root version, replace IMSUM with IMSUB. With coefficients 1, 2, and 5, these expressions return -1+2i and -1-2i. If you only need real solutions, checking the discriminant first and reporting that it is negative may be clearer than displaying complex values.

Other common edge cases include a zero coefficient for a or coefficients stored as text rather than numbers. A zero a means you should solve a linear equation instead. Text entries that look numeric can cause unexpected calculation behavior, so confirm that the coefficient cells contain numbers and not labels or pasted text. Also avoid rounding the coefficients in the formulas; use cell formatting to control displayed decimals while retaining the underlying values.

Choose a method and troubleshoot results

Use the quadratic formula when the equation is exactly quadratic and you want a reproducible calculation of both roots. Use Goal Seek when the expression is part of a larger worksheet model, the equation cannot be rearranged conveniently, or you want to find an input that makes a calculated output equal a target. Goal Seek is not a substitute for understanding whether other roots exist; it finds a root near its initial guess, not a complete list of solutions.

  • Both roots are identical: Check whether the discriminant is zero. A repeated root is expected in that case.
  • You see #NUM!: Check the discriminant. If it is negative, the roots are complex rather than real.
  • You see #DIV/0!: Check whether the coefficient a is zero.
  • The answer seems wrong: Confirm coefficient order, signs, and parentheses. For ax² + bx + c, a multiplies x squared, b multiplies x, and c is the constant.
  • Goal Seek returns an unexpected root: Try a different starting guess, then verify the result by calculating the equation value at that x.

When formulas are copied to other rows, use relative references only if the coefficient cells should move with the copied formula. If the coefficients remain fixed, references such as $B$1 can lock them in place. The dollar signs are useful for copying a model but are not required for a single calculation. For many equations, keep each coefficient set in a separate row and design the formulas around that table so you can fill them down consistently.

Frequently Asked Questions

Does Excel have a quadratic formula function?
No single built-in function returns both roots from three coefficients. Enter the quadratic formula using SQRT and cell references, or use Goal Seek to find one root numerically.

Can Excel find both roots automatically?
The two quadratic-formula expressions calculate both roots directly when they are real. Goal Seek finds one root per run, so a second run with a different initial guess may be needed to locate another root.

Why does my Excel quadratic formula return #NUM!?
The likely cause is a negative discriminant, which makes SQRT return #NUM! for a real-number calculation. The equation then has complex roots. Also check that the coefficient references and signs are correct.

Can Goal Seek solve any quadratic equation?
It can search for a root by adjusting a cell in a worksheet calculation, but it is not guaranteed to find every root. The result depends on the starting guess and the expression. The direct formula is preferable for a straightforward quadratic.

What if the coefficient of x² is zero?
Then the equation is not quadratic. It is linear if the coefficient of x is nonzero, and the quadratic formulas divide by zero. Check the value of a before calculating roots.

Related

Try it: the Formula Explainer: paste any formula and see each function and reference in plain English.

More in Formulas & functions

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

Spotted an error in this guide? Let us know.