Updated May 9, 2023

**Excel MMULT ( Table of Contents)**

## Introduction to MMULT in Excel

In mathematical terms, multiplying two matrices with each other is called matrix multiplication. Multiplying two matrices has certain rules, though. Since the product of matrices is given by multiplying the elements of each row of the first matrix with the elements of each column of the second matrix, it becomes mandatory to have several columns from the first matrix equal to the number of rows from the second matrix.

### What is MMULT Function in Excel?

In Excel, we have a function called “MMUL”, an array function, which is part of a variety of formulae under the “Math & Trigonometry” function, which can be found under the Formulas section. In Excel, the MMULT can have a product of two matrix arrays within Excel in which the number of rows from the first matrix equals the number of columns from the second matrix.

**Syntax:**

Below is the syntax for the MMULT function in Excel.

**Arguments:**

**array1**– This is a required argument for the function specifying the first matrix array you want to multiply.**array2**– This is a required argument for the function specifying the second matrix array you want to multiply.

A comma separates both these arguments in the MMULT function. It means after you enter the first array in the formula, you should mention a comma (“,”) before you add the second array argument.

As mentioned at the start, MMULT is an array function. Thus, while executing it, you must simultaneously press the Ctrl + Shift + Enter button instead of directly pressing the Enter key through your keyboard.

### Examples of MMULT in Excel

Let’s have hands-on experience with some examples.

#### Example #1 – Using MMULT to Multiply Two Matrices

Suppose we have two matrices with two rows, three columns, and three rows, two columns, respectively, as shown below.

After we go for a product of these two matrices, they, at most, can produce two rows and two columns (this is because we have two rows in First Matrix and two columns in Second Matrix). Hence, our resultant matrix will be a 2X2 matrix. We will store the same under cells varying from A6:B8, as shown below:

**Step 1:** Select all the cells (A7:B8) from Resultant Matrix to apply the formula immediately.

**Step 2:** Inside the active cell (cell A7), start initiating the formula for matrix multiplication. Use **=MMULT(** in the cell to initiate the formula.

**Step 3:** Use the First Matrix cells, i.e., from A2 to C3, as a first array argument under the formula for Matrix Multiplication. Give a comma (“,”) after the first array is set in the formula.

**Step 4:** Use Second Matrix cells, i.e., from E2 to F4, as a second array argument under the formula for Matrix Multiplication. Close the parentheses to complete this formula.

**Step 5:** The formula is now complete. But don’t press the Enter button directly. Remember, the MMULT function is an array function. Instead of pressing Enter, use **Ctrl + Shift + Enter** to get the output of this formula.

You’ll get the output of the multiplication/product of two matrices as shown below across cells A7:B8:

Notice the curly open and close braces under which the formula for MMULT is wrapped. These braces are indicators that the formula we have entered is an array formula or is applied on arrays.

**How does the formula work? Let’s see below:**

The matrix multiplication is like each element of every row from the first matrix gets multiplied by each element of every column from another matrix. Then, we will sum all the element-wise values to get a single value. The first row for First Matrix is 2, 6, and 3, and the first column of the Second Matrix has values 2, 7, and 4. Going with element-wise multiplication, we will get –

(2*2) = 4, (6*7) = 42 and (3*4) = 12 as multiplication results. Now, we will add these three values together to get the first element of the Resultant Matrix.

4 + 42 + 12 = 58.

Thus, the first element of the Resultant Matrix will be 58.

#### Example #2 – Using MMULT to Multiply Two Matrices

Suppose we have two matrices, as shown below, with three rows and three columns:

We will use the MMULT to have the product of these two matrices and get a new Resultant Matrix, which can be stored in A7:C9.

Since we have three rows in the First Column and the same number of columns in the Second Matrix, the Resultant Matrix will have three rows and three columns.

**Step 1:** Select all cells across A7:C9 under Resultant Matrix and initiate a formula for MMULT in cell A7.

**Step 2:** Use the First Matrix as a first argument under the MMULT function, spread across A2:C4. Use a comma to separate the first argument from the second.

**Step 3:** Use the Second Matrix as a second array argument under the MMULT function, which is spread across E2:G4. Complete the formula by adding a parenthesis that closes the formula.

**Step 4:** Now, press **Ctrl + Shift + Enter** to get the output of this array formula instead of the press Enter key. You’ll get an output as shown below:

This is how we can use the MMULT function to get the matrix multiplication for two matrix arrays. Let’s wrap things up with some points to be remembered:

### Things to Remember

- The MMULT function, because it returns an array value, must be specified as an array formula. For this to happen, you must use the Ctrl + Shift + Enter button instead of entering the button when you execute the MMULT formula.
- You will get a #VALUE! Error if the number of rows from the First Matrix and the column from the Second Matrix does not match. Also, we will get the same error if any cells are empty or have text values stored in them for any matrix.
- We may get the #N/A error if we have selected the cells within the Resulting Matrix that is not a part of it.

### Recommended Articles

This is a guide to MMULT in Excel. Here we discuss How to use MMULT in Excel, practical examples, and a downloadable Excel template. You can also go through our other suggested articles –