MMULT in Excel
Last Updated :
21 Aug, 2024
Blog Author :
Wallstreetmojo Team
Edited by :
Ashish Kumar Srivastav
Reviewed by :
Dheeraj Vaidya
Table Of Contents
What does MMULT Do in Excel?
MMULT, a Math & Trigonometry function in Excel, stands for "Matrix Multiplication." It returns the product of two arrays of two matrices where the number of rows of Matrix 1 equals the number of columns of Matrix 2.
This function applies the logic of multiplying one Matrix by another Matrix using the "Dot Product" of rows and columns. For example, look at the two matrix tables in Excel.
Table of contents
The above image has two matrix tables, Matrix 1 and Matrix 2. Multiplication of matrices is done using the "Dot Product" method of rows and columns. The first row of "Matrix 1" is multiplied by the first column of "Matrix 2."
The first column of "Matrix 1" has three numbers. And the first row of "Matrix 2" has three numbers. So, the first number of "Matrix 1" columns will be multiplied by the first number of "Matrix 2" rows. Like this, all the values are multiplied. In the end, a summation of these values has arrived.
The MMULT function in Excel will also do it.
Syntax
This function has two arguments: Array 1 and Array 2.
- Array 1 will be "Matrix 1" table values
- Array 2 will be "Matrix 2" values.
One special note we all need to be aware of is that MMULT is an array function, so after selecting the "Matrix 1" and "Matrix 2" values, we need to close the formula as an array formula by pressing the "CTRL + SHIFT + ENTER" keys.
Array Formulas in excel closing keys.
We know it isn't easy to understand formula logic by just reading the theoretical part. But nothing to worry about because we will show you enough examples with proper explanations to understand better.
How to Use the MMULT Function in Excel? (with Examples)
Example #1
Consider below two matrices for this example.
By multiplying these two matrices, we will create "Matrix 3". To apply the MMULT function, we need to decide the matrix table length. It is determined by the number of rows of "Matrix 1" and the number of columns of "Matrix 2."
- In this example, for "Matrix 1," we have two rows. For "Matrix 2," we have two columns. So, "Matrix 3" will be a 2 * 2 matrix. So, select 2 * 2 rows and columns to create a new "Matrix 3."
- Step 1: First, we must open the MMULT function.
- Step 2: For Array 1 argument, select "Matrix 1" table values from A3 to C4.
- Step 3: For Array 2 argument, select "Matrix 2" table values from E3 to F5.
- Step 4: Then, close the bracket but do not press the "Enter" key straight away because this is an array formula. We must press the "Enter" key by holding the Ctrl and Shift keys together. When we close the formula, we get curly brackets by holding the "Ctrl + Shift + Enter" keys.
So, we have got the result in "Matrix 3."
If you are wondering how we got these values, we will explain them to you now.
The first row values of "Matrix 1" are "2, 1, 7," the first column values of "Matrix 2" are "8, 8, 2," and the first value of "Matrix 3" is "38". It is achieved following the below equation.
- =(2 * 8) + (1 * 8) + (7 * 2)
- =16 + 8 + 14
- = 38
The second value in "Matrix 3" is 27, first row values of "Matrix 1" achieve this is "2, 1, 7" and second column values of "Matrix 2" is "3, 7, 2".
- =(2 * 3) + (1 * 7) + (7 * 2)
- =6 + 7 + 14
- = 27
Like this, MMULT performs its job.
Example #2
Now, look at the two equations.
This time we have a 3 * 3 matrix so that the new matrix will be the number of rows of "Matrix 1" and the number of columns of "Matrix 2." So the new "Matrix 3" will also be 3 * 3 matrix only.
- Now, we must apply the MMULT function.
- Then, we must press the "Ctrl + Shift + Enter" keys to get the result.
Things to Remember
- The MMULT function is an array function, so we must close with array function keys Ctrl + Shift + Enter.
- To multiply "Matrix," the number of columns of "Matrix 1" should be equal to the number of rows of "Matrix 2." Otherwise, we will get #VALUE! Error.
Recommended Articles
This article is a guide to the MMULT Function in Excel. We discuss how to use the MMULT function to get the multiplication of a matrix with examples and a downloadable Excel template. You can learn more from the following articles: -