M mult
MMULT Function¶
The MMULT function in Excel returns the matrix product of two arrays. The matrix product is the result of multiplying two matrices, where the number of columns in the first matrix must equal the number of rows in the second matrix.
Syntax:¶
MMULT(array1, array2)
- array1: The first matrix (array or range) to multiply.
- array2: The second matrix (array or range) to multiply.
The number of columns in array1 must be equal to the number of rows in array2.
Examples:¶
-
Matrix Product of 2x2 Matrices
and C1:D2 contains: Formula:
If the range A1:B2 contains:=MMULT(A1:B2, C1:D2)
Returns: Explanation: Each element is the dot product of the corresponding row and column. -
Matrix Product of a 2x3 and a 3x2 Matrix
and D1:E3 contains: Formula:
If A1:C2 contains:=MMULT(A1:C2, D1:E3)
Returns: Explanation: Excel multiplies rows of the first matrix by columns of the second matrix.
Usage Notes:¶
- The number of columns in the first matrix must equal the number of rows in the second matrix; otherwise, Excel will return a
#VALUE!error. - The resulting matrix will have dimensions equal to the number of rows in
array1and the number of columns inarray2. - The
MMULTfunction must be entered as an array formula in versions prior to Excel 365:- Select the output range with appropriate dimensions.
- Enter the formula and press
Ctrl + Shift + Enter.
- In Excel 365 and Excel 2021, dynamic arrays automatically spill the result.
- All elements in the arrays must be numeric; non-numeric values will result in a
#VALUE!error. MMULTis widely used in fields like engineering, statistics, and data analysis for matrix multiplication and linear transformations.