Returns the matrix product of two arrays. The result is an array with the same number of rows as array1 and the same number of columns as array2.
Syntax
MMULT(array1,array2)
Array1, array2 are the arrays you want to multiply.
Remarks
-
The number of columns in array1 must be the same as the number of rows in array2, and both arrays must contain only numbers.
- Array1 and array2 can be given as cell ranges, array constants, or references.
- If any cells are empty or contain text, or if the number of columns in array1 is different from the number of rows in array2, MMULT returns the #VALUE! error value.
- The matrix product array a of the two arrays b and c is:
where i is the row number, and j is the column number.
- Formulas that return arrays must be entered as array formulas.
Example 1
The example may be easier to understand if you copy it to a blank spreadsheet.
- Create a blank spreadsheet.
- Select the example in the Help topic.
Selecting an example from Help
- Press CTRL+C.
- In the spreadsheet, select cell A1, and press CTRL+V.
- To switch between viewing the formula that returns the result and the result in the cell, select the cell and press F2 and then ENTER, or click Commands and Options on the spreadsheet toolbar, click the Formula tab, and look in the Formula in active cell (active cell) box.
Array 1 | Array 1 |
---|---|
1 | 3 |
7 | 2 |
Array 2 | Array 2 |
2 | 0 |
0 | 2 |
Formula | Formula |
=MMULT(A2:B3,A5:B6) | |
Note The formula in the example must be entered as an array formula. After copying the example to a blank spreadsheet, select the range A8:B9 starting with the formula cell. Press F2, and then press CTRL+SHIFT+ENTER. If the formula is not entered as an array formula, the single result is 2.
Example 2
The example may be easier to understand if you copy it to a blank spreadsheet.
- Create a blank spreadsheet.
- Select the example in the Help topic.
Selecting an example from Help
- Press CTRL+C.
- In the spreadsheet, select cell A1, and press CTRL+V.
- To switch between viewing the formula that returns the result and the result in the cell, select the cell and press F2 and then ENTER, or click Commands and Options on the spreadsheet toolbar, click the Formula tab, and look in the Formula in active cell (active cell) box.
Array 1 | Array 1 |
---|---|
3 | 0 |
2 | 0 |
Array 2 | Array 2 |
2 | 0 |
0 | 2 |
Formula | Formula |
=MMULT(A2:B3,A5:B6) | |
Note The formula in the example must be entered as an array formula. After copying the example to a blank spreadsheet, select the range A8:B9 starting with the formula cell. Press F2, and then press CTRL+SHIFT+ENTER. If the formula is not entered as an array formula, the single result is 6.