Excel has no dedicated quadratic-equation function, but you can solve a quadratic directly with cell formulas. For an equation written as ax² + bx + c = 0, calculate the discriminant and use the quadratic formula; for example, a = 1, b = −5, and c = 6 produce roots 3 and 2.
What Excel can do with a quadratic
A quadratic equation has the form ax² + bx + c = 0, where a, b, and c are numbers and a cannot be zero for the equation to be quadratic. Its solutions, also called roots or zeros, are the x-values that make the equation equal zero. Excel can calculate them with ordinary arithmetic and the SQRT function, so a separate solver add-in is not necessary for standard cases.
The method has two useful advantages over entering numbers into a calculator: you can change the coefficients and have Excel recalculate the roots, and you can check the answers by substituting them back into the original equation. The main qualification is that the usual quadratic formula produces real-number results only when its discriminant is zero or positive. A negative discriminant means the equation has complex roots.
Set up the coefficients in a worksheet
On a blank worksheet, put labels in column A and the corresponding coefficients in column B. For instance, use A2 for a, A3 for b, and A4 for c; enter the numbers in B2, B3, and B4. For the example x² − 5x + 6 = 0, enter 1 in B2, −5 in B3, and 6 in B4. Keeping the coefficients in separate cells makes the formulas easier to inspect and reuse.
Leave room below the inputs for the discriminant and the two roots. You might label A6 as Discriminant, A7 as Root 1, and A8 as Root 2. The exact labels do not affect the calculations. What matters is that each formula refers to the cells containing the intended coefficients. If your worksheet uses different cells, change the cell references in the formulas accordingly.
Calculate the discriminant
The discriminant is D = b² − 4ac. Its value tells you how many real roots to expect: a positive discriminant gives two distinct real roots, zero gives one repeated real root, and a negative discriminant gives two complex roots and no real roots.
With a in B2, b in B3, and c in B4, enter this formula in B6:
=B3^2-4*B2*B4
For the example coefficients, the result is 1: (−5)² − 4 × 1 × 6 = 25 − 24 = 1. The caret means “raise to a power,” so B3^2 squares the coefficient in B3. Excel follows the normal order of operations, and the multiplication signs are included explicitly to make the calculation clear.
Calculate both real roots
The quadratic formula is x = (−b ± √D) ÷ (2a). In Excel, put one version in the cell for the first root and the other in the cell for the second. With a in B2, b in B3, c in B4, and the discriminant in B6, enter this formula in B7:
=(-B3+SQRT(B6))/(2*B2)
With the same cell layout, enter this formula in B8:
=(-B3-SQRT(B6))/(2*B2)
For x² − 5x + 6 = 0, B7 returns 3 and B8 returns 2. The order is not important: the plus version is not guaranteed to be the larger root for every possible set of coefficients. The formulas require a nonzero value in B2 and a nonnegative discriminant in B6. If either condition is not met, the result needs a different treatment rather than being interpreted as a valid real root.
What if the roots are complex?
When the discriminant is negative, SQRT of that value returns the Excel error #NUM!, because ordinary real-number square roots do not include negative inputs. That error does not mean the equation has no solutions at all; it means it has no real solutions. Its two complex roots have the same real part and opposite imaginary parts.
For a negative discriminant, you can calculate those two parts separately. With a in B2, b in B3, and the discriminant in B6, enter this formula in B7 for the real part:
=-B3/(2*B2)
With the same cell layout, enter this formula in B8 for the positive magnitude of the imaginary part:
=SQRT(-B6)/(2*ABS(B2))
If the coefficients are a = 1, b = 4, and c = 13, then D = −36. The real part is −2 and the imaginary magnitude is 3, so the roots are −2 + 3i and −2 − 3i. Excel displays the two parts as numbers; combine them conceptually with plus or minus i rather than treating B7 or B8 alone as a complete root. These formulas assume a is not zero and D is negative.
Check the answers and handle special cases
A useful check is to substitute each calculated root into the left side of the original equation. The result should be zero, or very close to zero if Excel’s floating-point arithmetic leaves a tiny rounding residue. With a in B2, b in B3, c in B4, and the first real root in B7, enter this formula in B9 to check that root:
=B2*B7^2+B3*B7+B4
For the example root 3, the result is 1 × 3² − 5 × 3 + 6 = 9 − 15 + 6 = 0. To check the second root, use its cell reference instead of B7. If the result is not close to zero, review the coefficient cells, the signs, and the denominator in the root formulas. Display formatting can round a number on screen without changing its stored value, so inspect the underlying result before concluding that a root is wrong.
If a = 0, the expression is not quadratic: it reduces to bx + c = 0. When b is nonzero, its single solution is −c/b. With b in B3 and c in B4, enter this formula in a result cell:
=-B4/B3
If both a and b are zero, there is no unique root: c = 0 makes every x a solution, while a nonzero c makes the equation impossible. Avoid applying the quadratic formulas to a = 0, because they divide by 2a. This distinction is especially useful when coefficients come from other formulas and may sometimes become zero.
When to use Goal Seek or Solver instead
For a known quadratic equation, direct formulas are usually the clearest method and return both roots at once. Goal Seek is an alternative when the equation is embedded in a larger worksheet model or when you want Excel to adjust one input until a calculated result reaches a target. It is an iterative what-if tool, not a special quadratic formula, and one run generally finds one solution based on the starting value.
For example, put a trial value for x in B2 and calculate ax² + bx + c in B3, with the coefficients stored in other cells. In Excel for Microsoft 365 on Windows, choose Data > What-If Analysis > Goal Seek. Set the cell containing the expression to 0, set the changing cell to the trial x cell, and select OK. Change the starting value and run it again if you want to look for another root; a quadratic can have two real roots, and an iterative search may settle on one depending on its starting point.
Solver is a separate add-in for optimization problems and can also be configured to make a formula cell equal zero by changing a variable cell. It is more useful when there are several changing cells, constraints, or an optimization objective than for a simple quadratic. On Windows, if Solver is not shown on the Data tab, go to File > Options > Add-ins, choose Excel Add-ins in the Manage box, select Go, check Solver Add-in, and select OK. The Mac menus differ; the worksheet formulas work in Excel for Mac as well. Excel for the web may not provide the desktop Solver add-in, so use formulas or a supported desktop version when you need that tool.
Common mistakes and practical tips
- Missing parentheses: The entire numerator −b plus or minus the square root must be divided by 2a. Parentheses around the numerator and denominator keep the intended order of operations explicit.
- Using the wrong coefficient: Match a to the x² term, b to the x term, and c to the constant. A missing term has a coefficient of zero; for example, x² − 9 = 0 uses b = 0.
- Entering a negative sign incorrectly: A negative b is still a signed coefficient. If b is −5, the formula’s −B3 correctly means subtract the value −5, yielding positive 5.
- Seeing #NUM!: Check the discriminant. A negative value indicates complex roots, not a failure of Excel to calculate real roots.
- Seeing #DIV/0!: The a coefficient is probably zero in a quadratic formula, or b is zero in the linear formula. Check the special cases before dividing.
- Rounding too early: Keep full precision in the formulas and apply number formatting to control how many decimals appear. Rounding intermediate values can make the check less accurate.
If you solve many equations, put the coefficient inputs and result formulas in a compact template, then copy the formulas down for additional rows. When copying, make sure each row points to its own coefficient cells. For a single equation, labels and a residual check are often enough to make the worksheet understandable to someone who opens it later.
Frequently Asked Questions
Does Excel have a built-in quadratic solver function?
No dedicated function solves a quadratic equation by name. Use the discriminant and quadratic-formula cell expressions for direct results. Goal Seek and Solver are available for iterative or optimization tasks, but they are not replacements for the direct formula when the coefficients are known.
How do I solve x² − 9 = 0 in Excel?
Use a = 1, b = 0, and c = −9. The discriminant is 36, so the roots are 3 and −3. A zero coefficient is valid; enter it explicitly rather than leaving the b input blank.
Why does my quadratic formula return #NUM!?
The most common cause is a negative discriminant, which makes SQRT return #NUM! for a real-number calculation. Confirm the coefficient signs and calculate b² − 4ac. If it is negative, the equation has complex roots rather than real ones.
Can Goal Seek find both roots?
Not in one run: Goal Seek adjusts one changing cell to reach one target, and its result can depend on the initial value. Run it again with a different starting value to search for another root, or use the quadratic formula to calculate both real roots directly.
Can I use these formulas in Excel for Mac or the web?
The arithmetic, exponent operator, and SQRT function used here are standard Excel features and work in current desktop Excel for Mac and Excel for the web. The desktop menus for Goal Seek and the availability of the Solver add-in can differ by platform and version.
Related
- Debt Snowball Spreadsheet: Build a Payoff Plan
- Excel Power Query Append Queries: Combine Tables Easily
- Wedding Budget Spreadsheet UK: Build a Practical Tracker
Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.
More in How-to basics
- How to Open Excel on Linux: Web, Apps, and WorkaroundsThe quickest way to open an Excel workbook on Linux is to use Excel for the web in…
- Outlook Browser Signature: How to Create One Step by StepTo create a signature in Outlook in your browser, open Settings, go to the signature settings, enter and…
- Shortcut Key to Refresh a PivotTable in Excel on WindowsIn Excel for Microsoft 365 on Windows, select a cell in the PivotTable and press Alt+F5 to refresh…
- Excel Keyboard Shortcut to Select a Column: Full GuideIn Excel for Microsoft 365 on Windows, select any cell in the column and press Ctrl+Space to select…
- Find Variable Names in Excel: A Practical GuideTo find variable names in Excel, open Formulas > Name Manager to review workbook-defined names, or use the…
- Google Sheets IF Statement Color: Change Cell ColorsAn IF formula in Google Sheets can return text or a number, but it cannot directly change a…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.