Excel Solve Quadratic Equations: Formulas and Examples

Formulas & functions · Updated November 21, 2026

Yes. In Excel for Microsoft 365, enter the coefficients a, b, and c in cells B2, B3, and B4, then use the quadratic formula; the expression under the square root determines whether the equation has real roots. For the first root, with those coefficients in B2:B4, enter =(-B3+SQRT(B3^2-4*B2*B4))/(2*B2).

What a quadratic equation is

A quadratic equation has the standard form ax² + bx + c = 0, where a, b, and c are numbers and a is not zero. The exponent 2 is what makes it quadratic. For example, x² – 5x + 6 = 0 is quadratic, while 5x + 6 = 0 is linear because it has no squared term.

The solutions, also called roots, are the values of x that make the equation true. A quadratic can have two different real roots, one repeated real root, or two complex roots. Excel can calculate the roots directly from the coefficients; you do not need to expand or factor the equation first.

The general method comes from the quadratic formula: x = (-b ± √(b² – 4ac)) / (2a). The ± symbol means calculate once with plus and once with minus. The value b² – 4ac is called the discriminant, and it tells you what kind of roots to expect.

Set up the coefficients in Excel

Make a small input table so each formula has a clear reference to the equation’s coefficients. For example, label A2:A4 as a, b, and c, and enter their numeric values in B2:B4. For x² – 5x + 6 = 0, enter 1 in B2, -5 in B3, and 6 in B4. Keep the minus sign with the coefficient: in this equation, b is -5, not 5.

Calculate the discriminant in B5. With a in B2, b in B3, and c in B4, enter this formula in B5:

=B3^2-4*B2*B4

The caret means “raised to the power of” in Excel, so B3^2 squares the value of b. In the example, the discriminant is 1: (-5)² – 4 × 1 × 6 = 25 – 24 = 1. Using a separate cell for the discriminant makes it easier to inspect the calculation and reuse it in both root formulas.

Calculate both roots with the quadratic formula

For the example, the two roots are 3 and 2. To calculate them generally, use one formula with the plus sign and another with the minus sign. With the coefficients in B2:B4 and the discriminant in B5, enter the following in B6 for the plus root:

=(-B3+SQRT(B5))/(2*B2)

With the same layout, enter this in B7 for the minus root:

=(-B3-SQRT(B5))/(2*B2)

For x² – 5x + 6 = 0, B6 returns 3 and B7 returns 2. You can check the answer by substituting each value into the original equation: 3² – 5 × 3 + 6 = 0, and 2² – 5 × 2 + 6 = 0. The order of the roots is not important.

If the discriminant is zero, the plus and minus calculations produce the same value. That is one repeated root, not two different solutions. For example, x² – 4x + 4 = 0 has a discriminant of zero and a repeated root of 2.

Handle equations with no real roots

Excel’s SQRT function returns a numeric result for zero or positive inputs. If the discriminant is negative, the equation has no real roots, and a direct formula using SQRT returns #NUM!. This is expected: it indicates that the square root of a negative number is not real, rather than proving that the equation has no solutions of any kind.

You can make the result clearer by checking the discriminant before calculating a real root. With coefficients in B2:B4 and the discriminant in B5, put this formula in B6 for the plus root:

=IF(B2=0,"Not quadratic",IF(B5<0,"No real roots",(-B3+SQRT(B5))/(2*B2)))

With the same layout, use this formula in B7 for the minus root:

=IF(B2=0,"Not quadratic",IF(B5<0,"No real roots",(-B3-SQRT(B5))/(2*B2)))

These formulas check that a is not zero and that the discriminant is not negative before attempting the division and square root. They return a message for a linear equation or an equation without real roots; otherwise, they return the numeric roots. If you need complex solutions, use complex-number functions or a tool that supports complex arithmetic rather than interpreting #NUM! as “no solutions.”

Find complex roots when the discriminant is negative

When the discriminant is negative, a quadratic with real coefficients has a pair of complex-conjugate roots. For example, x² + 1 = 0 has roots i and -i, where i is the imaginary unit. Excel provides engineering functions for complex values, including COMPLEX, IMSQRT, IMSUM, IMSUB, and IMDIV. These functions return complex values as text, so format the output cell as General if Excel displays the result unexpectedly.

For this method, use B2:B4 for the coefficients and B5 for the discriminant as above. To calculate the plus root when B5 is negative, enter:

=IMDIV(IMSUM(COMPLEX(-B3,0),IMSQRT(COMPLEX(B5,0))),COMPLEX(2*B2,0))

For the other root, with the same cell layout, enter:

=IMDIV(IMSUB(COMPLEX(-B3,0),IMSQRT(COMPLEX(B5,0))),COMPLEX(2*B2,0))

For x² + 1 = 0, enter 1, 0, and 1 in B2, B3, and B4. The discriminant is -4, and the two formulas return i and -i (Excel may display them as 0+1i and 0-1i). If your Excel installation does not recognize an engineering function, check that Excel is up to date and that the function is available in your version.

Check whether the equation is actually quadratic

The quadratic formula divides by 2a, so it cannot be used when a equals zero. In that case, the equation is linear if b is nonzero, and its solution is x = -c/b. If both a and b are zero, the expression is a constant: when c is zero every value satisfies the equation, and when c is nonzero there is no solution.

If B2 is zero and the other coefficients remain in B3 and B4, this formula handles the linear or constant cases:

=IF(B3=0,IF(B4=0,"All values satisfy","No solution"),-B4/B3)

This distinction matters when coefficients are produced by other formulas or entered by users. A formula that divides by zero may show #DIV/0!, which is not a valid root. A check for a = 0 prevents treating a linear equation as though it were quadratic.

Use Goal Seek for a different kind of equation

The quadratic formula is usually the simplest way to solve a standard quadratic. Excel’s Goal Seek can be useful when you have an equation written as a worksheet calculation and want Excel to find an input that makes its result equal a target. On Excel for Microsoft 365 for Windows, choose Data > What-If Analysis > Goal Seek. Set the formula cell to 0 and choose the cell containing the variable Excel may change.

For example, you could put a trial value of x in A1 and calculate a*x^2 + b*x + c in A2 using the coefficient cells. Goal Seek can adjust A1 to make A2 equal zero. It finds one solution near the starting value; it does not promise to list both roots. Run it again from a different starting value to look for another root, or use the quadratic-formula method when you want both roots directly.

Goal Seek is an iterative numerical method, so its result can depend on the initial guess and settings. It is not a replacement for checking the discriminant or recognizing when the equation has complex roots. The menu and feature availability can vary across Excel platforms and editions; the direct cell formulas work in desktop Excel for Windows and Mac, and in Excel for the web when the functions used are supported.

Common errors and ways to check the result

Most incorrect answers come from the setup rather than from the quadratic formula itself. Check the signs and references before changing the calculation. These are useful checks:

  • Use the signed coefficient. For x² – 5x + 6 = 0, enter -5 for b. The formula already applies the negative sign in –b.
  • Confirm parentheses. The denominator is the entire value 2a, so use (2*B2), not a formula that divides by 2 and then multiplies by a.
  • Check that the equation equals zero. Rearrange an equation such as x² = 5x – 6 to x² – 5x + 6 = 0 before identifying its coefficients.
  • Distinguish a text number from a numeric value. If a coefficient was imported or typed with an apostrophe, Excel may treat it as text. Convert it to a number before calculating.
  • Substitute the roots back into the original equation. A result close to zero is a practical check. Tiny residual differences can occur because spreadsheet calculations use finite precision.

Do not round the coefficients or intermediate discriminant just to make the displayed result look tidy. Apply number formatting to the result cells if you want fewer displayed decimal places; formatting changes what you see, not the stored calculation. If coefficients are approximate measurements, the roots are approximate too.

Frequently Asked Questions

Can Excel solve a quadratic equation automatically?
Yes. For a standard equation in the form ax² + bx + c = 0, enter the coefficients and use the quadratic formula in worksheet cells. Excel calculates the roots from the values; it does not need a special quadratic-solving command.

Does Excel have a QUADRATIC function?
No built-in worksheet function named QUADRATIC is needed for this calculation. Use SQRT with the quadratic formula, and optionally use IF to handle negative discriminants or a zero value for a.

Why does my formula return #NUM!?
A common cause is a negative discriminant passed to SQRT. The equation then has no real roots, although it has complex roots. Check the discriminant cell; use an IF check for real-root calculations or complex functions if you need complex answers.

Why do I get only one answer from Goal Seek?
Goal Seek searches for one input value that makes a formula reach a target, starting from a supplied value. A quadratic may have two roots, so calculate both with the plus and minus versions of the quadratic formula, or run Goal Seek again with a different starting value.

What if the coefficient of x² is zero?
Then the equation is not quadratic. If the coefficient of x is nonzero, solve the resulting linear equation with x = -c/b. If both variable coefficients are zero, the equation is either always true or has no solution, depending on the constant.

Do the formulas work in Excel for Mac or Excel for the web?
The arithmetic formulas use standard worksheet functions and work in current Excel versions that support them, including Microsoft 365 on Windows and Mac. Excel for the web supports ordinary cell formulas too, although some desktop tools and menus, such as Goal Seek, may not be available in every web version.

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.