How to Use MMULT Function in Excel (6 Examples)

Get FREE Advanced Excel Exercises with Solutions!

The MMULT function stands for “Matrix Multiplication”. It is a math and trigonometry function available in Microsoft Excel. The MMULT function multiplies two arrays and returns another matrix array. In this article, you will get to know the usage of the Excel MMULT function with 6 proper examples.

Excel MMULT Function Overview

The above screenshot is an overview of the article, representing an application of the MMULT function in Excel. You’ll learn more about the methods along with the other functions to use the MMULT function precisely in the following sections of this article.


MMULT Function in Excel: Syntax

  • Function Objective:

The MMULT function multiplies two arrays of numbers and returns another array of numbers.

  • Syntax:

MMULT(array1, array2)

  • Arguments Explanation:
Argument Required/Optional Explanation
array1 Required The first array that you want to multiply.
array2 Required The second array that you want to multiply.
  • Return Parameter:

A matrix of number arrays.


Basics of Matrix Multiplication

Suppose, we have two matrices, A and B. Where A is an m by n matrix and B is an n by p matrix.

The product of these two matrices, C = AB; can be written as

The product of A and B that is C can also be written as,


Example 1: Inserting Number Arrays Manually in MMULT Function in Excel

The MMULT Function allows us to manually insert the number of arrays to get their product. To do this,

❶ First you have to select the number of cells as to the output array matrix dimension.

❷ Then in the top-left-corner cell of the selection area, you have to insert the formula with the MMULT function. For this instance, the formula is:

=MMULT({1,2,3;4,5,6},{2,5;4,2;6,9})

❸ After that, press the CTRL + SHIFT + ENTER button to execute the formula.

Insert Number Arrays Manually in MMULT Function in Excel

After pressing the CTRL + SHIFT + ENTER, you will see the carl brackets wrapped up in the formula. This is because the formula is in the form of a legacy array formula.

📓 Note

If you are using Microsoft Office 365, then you don’t need to select the range of cells and then press CTRL + SHIFT + ENTER. Because Office 365 supports dynamic array formulas. That’s why all you need to do is just insert the formula and then press the ENTER button only.


Example 2: Using the MMULT Function in Excel to Multiply Two 3×3 Matrices 

In this section, we will calculate the multiplication of two square matrices having a dimension of 3×3.

The first array has a dimension of 3×3 and the second array has also a dimension of 3×3. As a result, the final matrix will have a dimension of 3×3  too.

Now follow the steps below to multiply two matrices using the MMULT function.

❶ Firstly, select a range of cells having a measurement of 3×3, as the output matrix dimension will be 3×3.

❷ Then insert the following formula onto the top-left corner of the selection area. Cell B10 for this instance.

=MMULT(B5:D7,F5:H7)

Here B5:D7 is the range of the first array and F5:H7 is the range of the second array.

❸ Finally press the CTRL + SHIFT + ENTER buttons altogether to execute the formula.

As the formula is a legacy array formula, the selection area will be filled with the output numbers. You don’t need to drag the formula to all the corresponding cells.

Multiply Two 3x3 Matrices Using the MMULT Function in Excel

📓 Note

As Microsoft Office 365 supports dynamic array formulas, you can just insert the formula with the MMULT function and then press the ENTER button. The dynamic array formula will automatically cover all the cells as to the dimension of the output matrix.


Example 3: Calculating the Product of a 2×3 Matrix with a 3×2 Matrix with the MMULT Function

This time, instead of taking two identical matrices, you are considering two arrays of different dimensions.

The first array is a 2×3 number matrix and the second one is a 3×2 matrix. So the number of rows in the first matrix is 2 and the number of columns in the second matrix is 2. As a result, the dimension of the final matrix will be 2×2.

Now to multiply them using the MMULT function, follow the steps below.

❶ Select 4 consecutive cells, having 2 rows and two columns.

❷ Insert the following legacy array formula to the top-left corner of the selected cells.

=MMULT(B5:D6,F5:G7)

❸ Hit the CTRL + SHIFT + ENTER buttons to execute the formula.

This procedure is applicable to all versions of Microsoft Excel, except Office 365.

To do the same task in Excel Office 365, just insert the formula in any cell and then press the ENTER button.

Product of a 2x3 Matrix with a 3x2 Matrix Using the MMULT Function in Excel


Example 4: Multiplying a 3×2 Matrix with a 2×3 Matrix Using Excel MMULT Function

This time the first array has a dimension of 3×2 and the second one has a dimension of 2×3. So the output array will have a dimension of 3×3.

Now follow the steps below to get the product of the two arrays using the MMULT function.

❶ First of all, select an area of 3×3 as the dimension of the output array will be 3×3.

❷ Input the following formula in the first cell of the selection area. Cell B10 for this instance.

=MMULT(B5:C7,E5:G6)

❸ Hit the CTRL + SHIFT + ENTER buttons altogether.

Get the Multiplication of a 3x2 Matrix with a 2x3 Matrix Using the MMULT Function in Excel

📓 Note

For the Microsoft Office 365 user, just insert the dynamic array formula in cell B10 and hit the ENTER button. The dynamic formula will automatically fit the required dimension of the output array.


Example 5: Using the MMULT Function to Multiply a 3×1 Matrix with a 1×3 Matrix

Now we are taking a 3×1 matrix and a 1×3 matrix. The number of rows in the first matrix is 3 and the number of columns in the second matrix is also 3. So, the output array will have a dimension of 3×3.

Now follow the steps below:

❶ Select 9 consecutive cells having 3 rows and 3 columns.

❷ Enter the following formula to the top-left corner of the selection area.

=MMULT(B5:B7,E5:G5)

❸ To execute the formula, hit the CTRL + SHIFT + ENTER buttons altogether.

Multiply a 3x1 Matrix with a 1x3 Matrix Using the MMULT Function in Excel

📓 Note

In Microsoft Office 365, instead of following the above steps, just insert the formula in cell B10 and press the ENTER button. The dynamic array formula will automatically fit the necessary area.


Example 6: Combining SUM, MMULT, TRANSPOSE, and COLUMN Functions to Count the Rows Having a Specific Value

This time we will count the total number of rows having the number 5. In this regard, one problem may arise. That is the number 5 can be present in more than one column.

So, we have to ensure that any being present in more than one column should be counted as only 1.

To do this we have used the SUM, MMULT, TRANSPOSE, and the COLUMN function to build a formula that will eliminate this problem and count only the number of rows having a specific number present in them.

Now follow the steps below to do that.

❶ Insert the following formula in cell D16.

=SUM(--(MMULT(--(B5:D14=5), TRANSPOSE(COLUMN(B5:D14)))>0))

❷ Press the CTRL + SHIFT + ENTER button to execute the formula.

If you are a Microsoft Office 365 user, then just press the ENTER button instead of pressing CTRL + SHIFT + ENTER buttons altogether.

Use SUM, MMULT, TRANSPOSE, and COLUMN Function to Count the Number of Rows Having a Specific Value


Things to Remember

📌 The number of columns in array1 must be the same as the number of rows in array2.

📌 If the cells are blank or contain any text, then the MMULT function returns a #VALUE error.

📌 The MMULT function also throws a #VALUE error, if the numbers of columns in array1 and the numbers of rows in array2 are mismatched.


Download Practice Workbook

You can download the Excel file from the link below and practice along with it.


Conclusion

To sum up, we have discussed 6 examples to guide you in using the MMULT function in Excel. You are recommended to download the practice workbook attached along with this article and practice all the methods with that. And don’t hesitate to ask any questions in the comment section below. We will try to respond to all the relevant queries asap.


<< Go Back to Excel Functions | Learn Excel

What is ExcelDemy?

ExcelDemy - Learn Excel & Get Excel Solutions Center provides online Excel training , Excel consultancy services , free Excel tutorials, free support , and free Excel Templates for Excel professionals and businesses. Feel free to contact us with your Excel problems.
Mrinmoy Roy
Mrinmoy Roy

Mrinmoy Roy, a dedicated professional with a BSc in Electronics and Communication Engineering from Khulna University of Engineering & Technology, Bangladesh, brings over two years of expertise to the ExcelDemy project. As a prolific contributor, he has authored around 180 articles, showcasing his deep knowledge and passion for Microsoft Excel, Data Analysis, and VBA. His unwavering commitment to continuous learning, combined with versatile skills, renders him well-suited for roles in data management and spreadsheet solutions. He has interest... Read Full Bio

2 Comments
  1. What is the feature in MMULT? What does it represent?
    Thanks

    • Reply Mahfuza Anika Era
      Mahfuza Anika Era Feb 27, 2024 at 3:52 PM

      Hello Roland Sprague,

      The MMULT function of Excel represents the matrix multiplication we perform in mathematics. We can use this function if there happens to be two ranges in a sheet representing two matrices and we want to multiply them.
      You can find out more about matrix multiplication in this section of the article. It is helpful for computing in linear algebra, transformation of coordinate systems, population modeling, etc.

      Regards
      Niloy
      ExcelDemy

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo