This tutorial explains how to perform **matrix multiplication** in Excel.

**Matrix Multiplication in Excel**

To perform matrix multiplication in Excel, we only need to use one function: **MMULT**. This function returns the matrix product of two arrays and uses the following syntax:

**MMULT(array1, array2)**

where **array1 **and **array2 **are the two arrays you want to multiply.

The following examples illustrate how to perform matrix multiplication for matrices of various sizes.

**Matrix Multiplication: (2×2) by (2×2)**

Suppose we have a **2×2 **matrix C, which has 2 rows and 2 columns:

Suppose we also have a **2×2 **matrix D, which has 2 rows and 2 columns:

Here is how to multiply matrix C by matrix D:

This results in the following 2×2 matrix:

Here is how to perform the equivalent matrix multiplication in Excel:

**Step 1: Enter the data values for the two matrices. **

**Step 2: Multiply the matrices.**

- First, highlight a 2×2 group of cells where the output will go. For example, highlight cells
**G2:H3**. - With the cells highlighted, type in
**=MMULT(A2:B3, D2:D3)**, then click**Ctrl+Shift+Enter**.

The following results will appear:

**Note: **It’s important to click **Ctrl+Shift+Enter** instead of just **Enter **after you type in the formula **=MMULT(A2:B3, D2:D3)**, otherwise a single value of “39” will appear in cell G2 without the other three values.

**Matrix Multiplication: (2×2) by (2×3)**

Suppose we have a **2×2 **matrix C, which has 2 rows and 2 columns:

Suppose we also have a **2×3 **matrix D, which has 2 rows and 3 columns:

Here is how to multiply matrix C by matrix D:

This results in the following 2×3 matrix:

Here is how to perform the equivalent matrix multiplication in Excel:

**Step 1: Enter the data values for the two matrices. **

**Step 2: Multiply the matrices.**

- First, highlight a 2×3 group of cells where the output will go. For example, highlight cells
**H2:J3**. - With the cells highlighted, type in
**=MMULT(A2:B3, D2:F3)**, then click**Ctrl+Shift+Enter**.

The following results will appear:

**Note: **It’s important to click **Ctrl+Shift+Enter** instead of just **Enter **after you type in the formula **=MMULT(A2:B3, D2:F3)**, otherwise a single value of “39” will appear in cell H2 without the other values.

**Matrix Multiplication: (3×3) by (3×2)**

Suppose we have a **3×3 **matrix C, which has 3 rows and 3 columns:

Suppose we also have a **3×2 **matrix D, which has 3 rows and 2 columns:

Here is how to multiply matrix C by matrix D:

This results in the following 3×2 matrix:

Here is how to perform the equivalent matrix multiplication in Excel:

**Step 1: Enter the data values for the two matrices. **

**Step 2: Multiply the matrices.**

- First, highlight a 3×2 group of cells where the output will go. For example, highlight cells
**H2:I4**. - With the cells highlighted, type in
**=MMULT(A2:C4, E2:F4)**, then click**Ctrl+Shift+Enter**.

The following results will appear:

**Note: **It’s important to click **Ctrl+Shift+Enter** instead of just **Enter **after you type in the formula **=MMULT(A2:B3, D2:F3)**, otherwise a single value of “19” will appear in cell H2 without the other values.

**Potential MMULT() ERRORS**

Note that there are a couple ways you may get an error using the **MMULT() **function.

**Error 1: The rows and columns are not compatible for matrix multiplication**.

To multiply two matrices together, the number of columns in the first matrix must be equal to the number of rows in the second matrix.

For example, we can multiply the following matrices together because the first matrix has **three** columns and the second matrix has **three** rows:

However, we can not multiply the following matrices together because the first matrix has **three **columns while the second matrix only has **two **rows:

If we attempt to use **MMULT() **to multiply these two matrices together, we will get a **#VALUE!** error.

**Error 2: Something other than a number is used in the matrices.**

If characters are used instead of numbers, we will also get a **#VALUE! **error.

For example, if we attempt to use **MMULT() **to multiply the following two matrices together, we will get a **#VALUE!** error:

The “three” in cell C3 needs to be changed to the numerical value 3:

**Additional Resources**

**Matrix Multiplication: (2×2) by (2×2)
Matrix Multiplication: (2×2) by (2×3)
Matrix Multiplication: (3×3) by (3×2)**