Matrix multiplication in Excel

In this Excel tutorial you will teach yourself about matrix multiplication in Excel. You will see how to use MMULT Excel function to multiply matrixes.

A matrix is a rectangular array of numbers, symbols, and expressions arranged in rows and columns. They are used to save large data sets that are in a relationship to each other. Matrices play a particularly important role in computer science and statistics, where huge data sets are often present. For our case matrixes have to contain just numbers.

Rules of calculations

There are a few rules to follow when you multiply matrices.

  1. To be able to multiply the first matrix (let's call it matrix A) needs to have the same number of rows as the number of columns of the second matrix (let's call it matrix B).
  2. Once we have the appropriate 2 matrices, what can we expect the resulting matrix (matrix C). It will have the size of the number of rows in matrix A and the number of columns in matrix B.

Here are my sample matrixes. Matrix A is 2x2 and Matrix is 2x3. The calculation is possible because the number of rows of matrix A is the same as the number of columns of matrix B. The numbers of columns of matrix A and rows of matrix B do not matter at all. 

sample matrixes

MMULT function

Then you need to use MMULT Excel function to multiply given arrays. We will use MMULT Excel function for matrix multiplication.

The syntax of MMULT function

=MMULT (array1, array2)

MMULT function takes arrays as arguments so it is obvious to use.

Arguments

array1 - The first array to multiply

array2 - The second array to multiply. 

 

Matrix multiplication

To use it, highlight the whole matrix and type formula in first cell.

MMULT formula in my example is =MMULT(A2:B3,D2:F3)

matrix multiplication

This is an array formula so press CTRL + SHIFT + ENTER keyboard shortcut.

matrix multiplied

This is how multiplied matrix looks like.

Things to remember

  • to multiply matrixes in Excel you need to use MMULT function
  • to be able to multiply the number of rows of the first array must be equal to the number of columns of the second one
  • to run an array formula you need to use CTRL + SHIFT + ENTER
  • array must contain only numbers
Further reading:
How to create a matrix chart in Excel?
Matrix Multiplication in Python