The Matrix Product of two matrices is given by multiplying the elements of each row of matrix 1 with the elements of each column of matrix 2, to create a resulting matrix that has the same number of rows as matrix 1 and the same number of columns as matrix 2.
The matrix product can only be calculated when the number of columns in matrix 1 is equal to the number of rows in matrix 2.
For the following two matrices:The matrix product is calculated as:
Further details of the Matrix Product are given on the Wikipedia Matrix Multiplication pageThe Excel MMULT function calculates the matrix product of two arrays (representing matrices).
The syntax of the function is:
where array1 and array2 are arrays of numeric values representing matrices, and where the number of columns in array1 is equal to the number of rows in array2.
The resulting matrix has the same number of rows as array1 and the same number of columns as array2.
Note: As the Excel Mmult function returns an array of values, the function must be entered as an Array Formula.
Inputting Array Formulas
To input an array formula, you need to first highlight the range of cells that the function is to be entered into. Type the function into the first cell of the range, and press Ctrl + Shift + Enter.
See the Excel Array Formulas page for further details.
In the example spreadsheet below, the 3x4 matrix in cells A1D3 is multiplied by the 4x2 matrix in cells F1G4, using the formula:
The resulting 3x2 matrix is shown in cells I1J3.
The Mmult function formula can be seen in the formula bar. The curly braces { } show that the function has been entered as an Array Formula.
For further details and examples of the Excel Mmult function, see the Microsoft Office website.
If you get an error from the Excel Mmult function, this is likely to be one of the following:
#VALUE!    Occurs if either:

#N/A    Occurs in cells outside the range of the resulting matrix. For example, if, in the example above, we had highlighted cells I1J4 before entering the Mmult function, the 'additional' cells, I4 and J4 are not part of the resulting matrix. Therefore, these cells will display the #N/A error. 
Be aware also that if, when you enter the Mmult function, you don't highlight the entire range of cells that is needed to display the resulting matrix, Excel will just show the part of the result that fits into the highlighted range. There will be no error message to let you know that your highlighted range is not big enough. This will also be the case if you fail to enter the formula as an array formula  the cell that you enter the formula into will just show you the first entry of the resulting matrix. 