ExcelFunctions.net Logo

The Excel MMULT Function

Home » Excel-Built-In-Functions » Excel-Math-Functions » Excel-Mmult-Function
Search this site:
Custom Search

Basic Description

The Excel MMULT function calculates the matrix product of two arrays (representing matrices).

The format of the function is :

MMULT( array1, array2 )

where array1 and array2 are arrays of numerical values, representing matrices, 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.

Matrix Product
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:
2x3 and 3x2 Matrices
The matrix product is calculated as:
Matrix Product
Further details of the Matrix Product are given on Wikipedia

As the Excel Mmult function returns an array of values, the function needs to be entered as an Array Formula.

Array Formulas:
To input an array formula, you need to first highlight the range of cells for the function result. Type your function into the first cell of the range, and press CTRL-SHIFT-Enter.

Go to the Excel Array Formulas page for more details.

Example

In the example below, the 3x4 matrix in cells A1-D3 is multiplied by the 4x2 matrix in cells F1-G4, to give the resulting 3x2 matrix in cells I1-J3.

The formula for the function can be seen in the formula bar. The curly braces { } show that the function has been input as an Array Formula.

Example of the Excel Mmult Function

Further information and examples of the Excel Mmult function can be found on the Microsoft Office website.


Common Errors

If you get an error from your Excel Mmult function this is likely to be one of the following :

#VALUE! -

Occurs if either:

     -   one of the supplied arrays contains a blank or a non-numeric value
or
     -   the number of columns in array1 is not equal to the number of rows in array2
#N/A -

Occurs in cells outside the range of the resulting matrix.

For example, if, in the example above, we had highlighted cells I1-J4 before entering the Mmult function, the 'additional' cells, I4 and J4 are not part of the resulting matrix. Therefore, these cells will return the #N/A error.

Be aware also, that if you don't highlight the full range of cells for 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 which you enter the formula into will simply show you the first entry of the resulting matrix.






Valid XHTML 1.0 Transitional

Disclaimer Privacy Policy

Copyright © 2008-2011 ExcelFunctions.net