We have the following three equations.
2x + 5y + 2z = -38
3x – 2y + 4z = 17
-6x + y – 7z = -12
We’ll determine the value of the three variables, x, y, and z.
Method 1 – Applying Cramer’s Rule to Solve Algebraic Equations with Multiple Variables in Excel
Steps:
- Write down the equations in cells in the B5:B7 range.
- Make a simple data range like in the image below. In cells in the C11:E13 range, we inserted the Coefficients of the variables x, y, and z. In cells in the F11:F13 range, we input the Constants.
- Select cell C15 and put in the following formula.
=C11
- Press the Enter key.
- Drag the Fill Handle tool up to cell E17 both vertically and horizontally.
- Select the cells in the C15:E17 range.
- Press Ctrl + 1.
- This opens the Format Cells dialog box.
- Move to the Border tab.
- Select the Style as shown in the picture below.
- Choose two outside borders like in the image.
- Click OK.
- The data range looks like a determinant.
- Select cell C19 and insert the following formula.
=F11
- Press Enter. We’re putting the Constants in the first column.
Note: In Dx, constants will sit in the first column. The coefficients of y and z will occupy the next two columns.
- Put the coefficients of y and z in the next two columns.
- In Dy, the constants will sit in the second column. The other two columns are occupied by the coefficients of x and z, respectively.
- In Dz, the constants will sit in the third column. The other two columns are occupied by the coefficients of x and y, respectively.
- Select cell D16 and put the following formula in the Formula Bar.
=MDETERM(C15:E17)
The MDETERM function determines the determinant of an array.
- Press Enter.
The determinant is -13.
- Similarly, calculate the determinant of Dx, Dy, and Dz.
- Select cell G5 and paste the formula below.
=G20/G16
- Press Enter.
That’s how we get the value of variable x.
- Similarly, find the value of y and z by dividing their determinant (Dy; Dz) with the determinant D, respectively.
Read More: How to Solve an Equation for X When Y is Given in Excel
Method 2 – Utilizing MINVERSE and MMULT Functions
Steps:
- Create a simple data range containing the Coefficients and Constants of the three equations like Method 1.
- Create the matrix A and matrix B as in the image below. The matrix A contains the coefficients of the variables. The matrix B includes the constants of the equations.
- Create a space for the inverse matrix of A.
- Select cell C19, which is the first cell in this area, and enter the following:
=MINVERSE(C15:E17)
The MINVERSE function returns the inverse matrix of a matrix. The main matrix should be stored in an array.
- Press Enter.
Note: If you are using any other version of Excel rather than Microsoft Excel 365, make sure to press CTRL+SHIFT+ENTER to get the result.
- Select cell G5 and paste in the following formula:
=MMULT(C19#,H15:H17)
The MMULT function multiplies two matrices in array form. Then, it returns the product in an array form.
- Hit the Enter key.
We get the values of the variables in cells in the G5:G7 range.
Read More: How to Solve 2 Equations with 2 Unknowns in Excel
Method 3 – Using the Solver Add-in to Solve Algebraic Equations with Multiple Variables in Excel
Steps:
- Create a basic outline like in the image below, as in Method 1.
- Construct a data range like the one below. It should contain the headings R.H.S and L.H.S horizontally and Equation 1, Equation 2, and Equation 3 vertically.
- Go to the File tab.
- Select Options from the menu.
- The Excel Options window opens up.
- Move to the Add-ins menu.
- Select Excel Add-ins from the Manage drop-down list.
- Click on Go.
- This opens the Add-ins dialog box.
- Check the box for Solver Add-in.
- Click OK.
- Create a data range like the picture below.
- Select cell C16 and insert the following formula:
=SUMPRODUCT(C11:E11,C21:E21)
The SUMPRODUCT function returns the sum of the products of the corresponding values from all the arrays. It takes one or more arrays as an argument, multiplies the corresponding values of all the arrays, and then returns the sum of the products.
- Hit the Enter key on your keyboard.
Note: For your convenience, we highlighted the cell ranges of the arguments in the picture above.
- Put the constant of Equation 1 in cell E16.
- Equivalently, fill up the fields of Equation 2 and Equation 3.
- Jump to the Data tab.
- Select Solver in the Analyze group.
- The Solver Parameters wizard opens.
- Put cell C16 in the Set Objective box.
- Put the cells in the C21:E21 range in the By Changing Variable Cells box.
- Click on the Add button.
- This opens the Add Constraint input box.
- Give the reference of cell C16 into the Cell Reference box.
- Select the equal sign (=).
- Give the cell reference of cell E16 into the Constraint box.
- Click on Add.
- Repeat the above steps for Equation 2 and Equation 3.
- Click on the OK button.
- This returns us to the Solver Parameters window.
- Untick the box for Make Unconstrained Variables Non-Negative.
- Choose Simplex LP from the Select a Solving Method drop-down list.
- Click on Solve.
- The Solver Results wizard will open.
- Select the OK button.
- We can see the values of the variables in cells in the C21:E21 range.
- Move the answers to the top of the sheet to make them visible. We transferred them to the cells in the G5:G7 range.
Read More: How to Solve System of Equations in Excel
Practice Section
We have provided a Practice section like below in each sheet on the right side.
Read More: How to Solve Polynomial Equation in Excel
Download the Practice Workbook
Related Articles
- How to Solve for x in Excel
- How to Solve System of Equations in Excel
- How to Solve Simultaneous Equations in Excel
- How to Solve Differential Equation in Excel
- How to Solve Exponential Equation in Excel
- How to Solve Cubic Equation in Excel
- How to Solve Colebrook Equation in Excel
- How to Solve Quadratic Equation in Excel VBA
<< Go Back to Excel Solve Equation | Excel Solver Examples | Solver in Excel | Learn Excel
Get FREE Advanced Excel Exercises with Solutions!