How to Multiply Matrices in Excel (2 Easy Methods)

Matrices are arrays of numbers. Multiplication of matrices has a wide range of uses in various fields like linear equations, network theory, etc. When two matrices are multiplied, the row elements of a matrix are multiplied with the corresponding column elements of another matrix. It can be a tiresome job to multiply matrices with a higher number of rows and columns manually. Fortunately, matrices can be easily multiplied in excel. This article shows two ways how to multiply matrices in excel.

Multiply two matrices in excel


Download Practice Workbook

You can download the practice workbook from the download button below.


2 Easy Ways to Multiply Matrices in Excel

We can multiply matrices in excel by entering a custom formula for each element of the product matrix. But this may not be advantageous for matrices with higher dimensions. Fortunately, Excel has an inbuilt function to multiply matrices. We are going to use the following dataset to illustrate the methods.

dataset to multiply two matrices


1. Multiply Matrices with the MMULT Function in Excel

The best way to multiply matrices is to use the MMULT function in excel. Follow the steps below to apply this method.

Steps

1. Before you attempt to multiply matrices, make sure that the second matrix you want to multiply has the same number of rows as the number of columns of the first matrix.

2. After that, you need to determine the dimension of the product matrix also. The dimension of a matrix refers to the number of rows and columns of the matrix. The product matrix will have the same number of rows as the first matrix and the same number of columns as the second matrix.

3. In the case of our dataset, the dimension of the product matrix will be 3×3.

4. Now select the proper dimension as follows where you want the product matrix.

5. Then, type the following formula.

=MMULT(B5:D7,F5:H7)

6. Now, press CTRL+SHIFT+ENTER. The formula will be entered as an array formula. Then, you will see the product matrix as follows.

matrices multiplied using the MMULT function in excel

7. In Microsoft 365, you can just press Enter alone. You don’t need to select the proper dimension either.

8. For other versions, excel will show the #Value! Error if you don’t select the proper dimension.

9. Excel will show that error also when the criteria of the number of rows of the second matrix equal to the number of columns of the first matrix are not fulfilled. Suppose enter the following formula instead by CTRL+SHIFT+ENTER.

=MMULT(B5:D7,F5:H6)

10. Now, you will see the following error.

11. The #Value! Error also occurs when any of the elements of the matrices is not a number.

Read More: Multiplication Formula in Excel (6 Quick Approaches)


2. Multiply Matrices in Excel Using Custom Formula

This method is not advantageous for multiplying matrices with higher dimensions. Yet, it gives a clear idea of what happens when using the MMULT function. Also, this gives a clear understanding of how to multiply two matrices.

Now, to apply this method, enter the following formulas in cells D10,D11,D12,E10,E11,E12,F10,F11 & F12 respectively.

=B5*F5+C5*F6+D5*F7
=B6*F5+C6*F6+D6*F7
=B7*F5+C7*F6+D7*F7
=B5*G5+C5*G6+D5*G7
=B6*G5+C6*G6+D6*G7
=B7*G5+C7*G6+D7*G7
=B5*H5+C5*H6+D5*H7
=B6*H5+C6*H6+D6*H7
=B7*H5+C7*H6+D7*H7

This will give the same result obtained in the earlier method. Now notice the formulas carefully. After that, you will easily understand the process of matrix multiplication.

Read More: How to Multiply in Excel: Columns, Cells, Rows, & Numbers


Things to Remember

  • Make sure the number of columns of the first matrix is equal to the number of rows of the second matrix before starting to multiply them.
  • Do not press Enter alone in the first method. Rather press CTRL+SHIFT+ENTER.

Conclusion

Now you know how to multiply matrices in excel. For further queries or suggestions, please use the comment section below.


Related Articles

Md. Shamim Reza

Md. Shamim Reza

Hello there! This is Md. Shamim Reza. Working as an Excel & VBA Content Developer at ExcelDemy. We try to find simple & easy solutions to the problems that Excel users face every day. Our goal is to gather knowledge, find innovative solutions through them and make those solutions available for everybody. Stay with us & keep learning.

We will be happy to hear your thoughts

Leave a reply

ExcelDemy
Logo