MMULT function
MMULT multiplies two matrices and returns the matrix product as an array. It is used for weighted portfolios, transformations and linear algebra in a sheet.
Example
Read it as a sentence: multiply the 2 by 2 grid in F1:G2 by itself, then show its top left value, which gives 7.
Syntax
MMULT(array1, array2)
-
array1(required) - The left matrix.
-
array2(required) - The right matrix; its row count must equal columns in array1.
Returns: The matrix product, which spills as an array.
One MMULT formula can fill more than one cell. When the result has several values, they spill into the cells below or to the right of the formula.
What Excel actually returns
Each formula below was run in desktop Excel. The result is exactly what the cell showed, errors included.
| Formula | Excel shows | Case |
|---|---|---|
=MMULT({1,2,3},{1;2;3}) | 14 | Row * column |
=MMULT(2,3) | 6 | Scalars |
=MMULT(Data!F1:G2,Data!F1:G2) | 7 | 2x2 * 2x2 |
=MMULT(Data!F1:G2,Data!J1:L2) | 9 | 2x2 * 2x3 |
=MMULT(Data!J1:L2,Data!F1:G2) | #VALUE! | 2x3 * 2x2 mismatch |
=MMULT(Data!F4:G5,Data!F1:G2) | #VALUE! | Text in matrix |
=MMULT(Data!D1:D2,{1,2}) | #VALUE! | Blank cells |
The Data sheet these formulas read
A cell that starts with = holds that formula.
Watch out for
- Dimensions must match or you get #VALUE!.
- For a simple dot product SUMPRODUCT is easier.
Where it works
- Excel
- MMULT is in every version of Excel from 2007 on.
- Google Sheets
- Same name, same behaviour for everyday use.
Part of Math and trig functions. Every result on this page was measured in desktop Excel, build 16.0.20527. Last updated .