Yes—but Excel Solver is not a dedicated matrix-equation solver. For a square linear system, use Excel’s MINVERSE and MMULT functions; use Solver when you need to optimize changing values subject to equations or other constraints.
What “matrix solver” means in Excel
A matrix is a rectangular arrangement of numbers. In a system of linear equations, a coefficient matrix and a vector of unknowns combine to produce a vector of results. For example, the equations 2x + y = 5 and x + 3y = 6 can be written as A times x equals b, where A is the coefficient matrix, x contains the unknowns, and b contains the right-hand-side values.
Excel has worksheet functions for matrix calculations, including MMULT for matrix multiplication and MINVERSE for finding the inverse of a square matrix. These are usually the direct tools for solving a small, square system of linear equations. Solver is a separate Excel add-in designed to find values that maximize or minimize an objective while meeting constraints. It can solve a system indirectly by minimizing its equation errors, but that is a different kind of task.
This distinction matters because entering a matrix into Solver does not automatically tell Excel to perform matrix algebra. You must either build the calculation with worksheet functions or define a meaningful objective, variable cells, and constraints for Solver.
Solve a square system with matrix functions
For the example system, enter the coefficients in A2:B3 and the constants in D2:D3:
- A2:B3 contains the coefficient matrix: 2, 1 in the first row and 1, 3 in the second.
- D2:D3 contains the constants 5 and 6.
- The unknown values will appear in F2:F3.
In matrix notation, the solution is x = inverse(A) multiplied by b. With the coefficient matrix in A2:B3 and the constants in D2:D3, enter this formula in F2:
=MMULT(MINVERSE(A2:B3),D2:D3)
In Excel for Microsoft 365 on Windows, the two answers spill into F2:F3: x is 1.8 and y is 1.4. Check them in the original equations: 2 × 1.8 + 1.4 = 5, and 1.8 + 3 × 1.4 = 6. The arithmetic satisfies both equations.
The formula works because the coefficient range is a 2-by-2 square matrix and the constants are a matching 2-by-1 vector. The result is a 2-by-1 vector. If your Excel uses semicolons rather than commas as formula separators because of regional settings, use the separator expected by that installation; the formula structure and cell references remain the same.
In Excel versions without dynamic arrays, select the two output cells F2:F3, type the formula, and confirm it as a legacy array formula. On Windows, that is Ctrl+Shift+Enter; on Mac, use Control+Shift+Return. Microsoft 365 normally spills the result from the single formula in F2, so do not select both cells first. The spill area must be empty or Excel will report a spill error.
Check the result against the original equations
A useful check is to multiply the coefficient matrix by the solution vector and compare the result with the constants. With A2:B3 holding the coefficients and F2:F3 holding the solution, enter this formula in E2:
=MMULT(A2:B3,F2:F3)
It returns 5 and 6 in E2:E3. Those values should match D2:D3. This check is valuable when you copy a system from a report or build a larger model: a plausible-looking answer is not proof that the ranges were selected in the right order.
To calculate the difference between the computed left-hand sides and the constants, with E2:E3 holding the computed values and D2:D3 holding the target values, enter this formula in G2 and copy it down to G3:
=E2-D2
For this example, both residuals are zero. For larger calculations, you may see tiny values close to zero because computers store many decimal numbers with finite precision. A difference such as 0.0000000001 may be rounding noise rather than a meaningful failure, so judge it against the precision your problem requires.
When Solver is the right tool
Solver is useful when the unknown cells must be chosen to achieve a goal, especially when the model includes limits or an objective such as minimizing cost, maximizing output, or reducing error. You can also use it to find values that satisfy equations, although matrix functions are more direct when the system is a simple square linear system.
For the example, put starting guesses for x and y in F2:F3. Calculate the left-hand sides in E2:E3 with MMULT, then calculate residuals in G2:G3. With those residuals in G2:G3, enter this objective formula in H2:
=SUMSQ(G2:G3)
The objective is the sum of the squared differences between the calculated and target values. It cannot be negative, and it equals zero when both equations match exactly. Solver can minimize it by changing F2:F3. In this two-equation example, the result should be approximately 1.8 and 1.4, with an objective effectively equal to zero.
To enable Solver in Excel for Microsoft 365 on Windows, choose File > Options > Add-ins. At the bottom, set Manage to Excel Add-ins and choose Go, then select Solver Add-in and choose OK. Open Data > Solver. Set the objective cell to H2, choose Min, and set the changing variable cells to F2:F3. Choose GRG Nonlinear for this squared-residual objective, then choose Solve. Solver is a desktop add-in; Excel for the web does not run the Solver add-in. On Mac, enable it through Tools > Excel Add-ins, select Solver Add-in, and then use Data > Solver.
For an actual optimization model, define the objective and constraints to reflect the real problem. For example, a production model might minimize total cost while requiring production quantities to meet demand and stay within capacity. Solver does not know what “best” means until the worksheet and Solver settings define it.
Know which method fits your problem
- Use
MINVERSEandMMULTfor a small, square linear system with one unique solution. They express the algebra directly and make the calculation easy to audit. - Use Solver when you are optimizing a result, have constraints such as nonnegative values or capacity limits, or need a least-squares fit to more equations than unknowns.
- Use ordinary formulas for simple rearrangements or one-variable equations. A matrix setup is unnecessary if it makes the workbook harder to understand.
A system with more equations than unknowns may not have an exact solution. Minimizing the sum of squared residuals with Solver can produce a least-squares fit, meaning the overall squared mismatch is as small as the model permits. A system with fewer independent equations than unknowns may have many solutions; Solver may return one that minimizes the chosen objective, but the equations alone might not determine a unique answer. Add appropriate constraints or a secondary objective only when the real problem justifies them.
Common errors and limitations
MINVERSE needs a square matrix. If the selected coefficient range has different numbers of rows and columns, the calculation cannot produce an inverse. If the matrix is singular—its rows or columns do not provide independent information—Excel cannot calculate a normal inverse and may return #NUM!. In practical terms, the equations may be redundant or fail to determine one unique solution. A matrix can also be close to singular, making the answer sensitive to small changes or rounding in the input data.
Check the dimensions and order of your ranges. The number of columns in the coefficient matrix must match the number of unknowns, and the constants must be arranged in the same equation order as the matrix rows. Reversing constants or swapping columns changes the mathematical problem, even if Excel accepts the formula.
For Solver, common problems include selecting the wrong objective cell, omitting a needed constraint, or giving the changing cells poor starting values in a difficult nonlinear model. A result that looks reasonable should still be checked in the original equations and against every model limit. Solver’s status message and stopping conditions matter; a result is not automatically a proof that a global best solution was found, particularly for nonlinear problems with multiple possible optima.
Practical checks before relying on a result
Keep inputs, unknowns, intermediate calculations, and outputs in clearly labeled areas. Label coefficient columns with the unknown they represent and label each equation row. This makes it easier to spot a misplaced value and helps another reader understand the model without reverse-engineering cell references.
For a small system, verify each equation by substituting the displayed answers. For a Solver model, review the objective value, residuals, constraints, and Solver status after it finishes. If the workbook will be reused, test it with a simple case whose answer is already known. These checks are especially important when input values change or formulas are copied to a larger range.
Frequently Asked Questions
Does Excel have a matrix solver function?
There is no single worksheet function named “matrix solver.” For square linear systems, combine MINVERSE and MMULT. The Solver add-in is an optimization tool that can also minimize equation errors when set up for that purpose.
Can Excel Solver solve simultaneous equations?
Yes. Set cells for the unknowns, calculate each equation’s residual, and minimize the sum of squared residuals. For a small, square linear system with a unique solution, the matrix-function method is usually more direct.
Why does MINVERSE return an error?
Check that the input is square and numeric. A singular matrix has no inverse, so Excel cannot return the ordinary inverse. If the matrix is singular, the equations may be redundant or may not specify one unique solution.
Can I use Solver in Excel for the web?
The Solver add-in is for desktop Excel and is not available to run in Excel for the web. Open the workbook in the desktop app to use Solver; worksheet formulas such as MMULT and MINVERSE are a separate matter.
What is the difference between Solver and MMULT?MMULT calculates a matrix product from values already in the worksheet. Solver searches for values in selected cells that optimize an objective while meeting specified constraints. One performs a calculation; the other searches for a solution under a model you define.
Related
- How to Insert a Row in Excel: Steps, Shortcuts & Tips
- Insert a Line Break in an Excel Cell on Any Device
- Import Multiple CSV Files into Excel: Fast Methods
Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.
More in How-to basics
- Select All in Google Sheets: Shortcuts and OptionsTo select all cells in a Google Sheets tab, click the blank square at the top-left corner of…
- Google Sheets: Get a List of Unique ValuesWith source values in A2:A, enter =UNIQUE(A2:A) in an empty cell to return each distinct value once. This…
- Export Outlook Contacts: Steps, Formats, and TipsTo export Microsoft Outlook contacts, open the People or Contacts area and use its export command to save…
- How to Create a Mail Merge Template in Microsoft WordCreate a mail merge template by starting a mail merge in Word, building the letter or other document,…
- How to Create a Distribution List in OutlookTo create a personal distribution list in Outlook, open People, choose New contact list in new Outlook or…
- How to Add a Header in Word: Step-by-Step InstructionsTo add a header in Microsoft Word, open the document, choose Insert > Header, select a layout, and…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.