In this article, you will learn matrix multiplication operation in Excel and how to use MMULT function.
Matrix multiplication refers to the product of two matrices. This is a different operation from scalar multiplication. For multiplying matrices, the number of columns in the first matrix must be equal to the number of rows in the second matrix. The resulting matrix has the number of rows of the first and the number of columns of the second matrix. For example, if you have matrix A (n by k) and matrix B (k by m), after multiplication you will get matrix C as n by m.
Matrix multiplication using MMULT function
Excel MMULT function is a mathematical function used to multiply matrices. After typing the function, select the cell range of two matrices respectively. The number of columns in the first matrix must be equal to the number of rows in the second matrix. For example, multiplication of matrix A (n by k) and matrix B (k by m) results in matrix C (n by m).
=MMULT (array1, array2)
- array1: select a cell range for the first matrix
- array2: select a cell range for the second matrix
For example, the following formula multiply 2 by 3 matrix in B4:D5 cell range by in cell range F4:G6 3 by 2 matrix.
=MMULT (B4:D5, F4:G6)
Matrix Multiplication Example
First of all enter the matrices A and B any cell range in Excel sheet. In the example below we write matrix A to B4:D5 and matrix B to F4:G6 range. After that select the cells where you want to place resulting matrix. We select D10:E11 range for this.
Once you have selected the resulting matrix cell range, and while still selected, write the formula =MMULT (B4:D5, F4:G6). But don’t press enter. Press Ctrl key and Shift key then Enter key at the same time. You will see curly brackets in the formula. Otherwise, you will get an error message.
We have multiplied row by column and the first matrix has 2 rows and the second one has 2 cols.
So the result we got 2 by 2 .
Important Note:
If you have Microsoft 365, you do not need CTRL + SHIFT + ENTER key combination. After writing formula just press the enter key.