Related Function:

The MMULT function 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)

#### Arguments

Argument Description
array1, array2 The arrays you want to multiply

 • The number of columns in array1 must be the same as the number of rows in array2 • Both arrays must contain only numbers • array1 and array2 can be given as cell ranges, array constants, or references

Inputting Array Formulas: To input an array formula,

1. highlight the range of cells for the function result,
2. type the function into the first cell of the range, and
3. press CTRL-SHIFT-ENTER

#### Examples

A B C D E F G H I
1   Product Quantity
2 Customer Widgets Cogs Sprockets   Formula Result Notes
3 Buyer-1 14 9 3   {=MMULT(B3:D4,A7:B9)} $6,325 779 Column G is the sales to Buyer-1 and Buyer-2 4 Buyer-2 2 11 15$9,525 2,195 Column H is the shipping weight of items sold to Buyer-1 and Buyer-2
5
6 Price Weight Product
7 $200 4 Widgets 8$250 42 Cogs
9 \$425 115 Sprockets

Note: The curly brackets, { and }, seen in the formulas in E2 and E7 are not entered by the user. Excel applies these to show the formula has been input as an array formula.

#### Common Function Error(s)

Problem What went wrong
#VALUE! Occurs if either:

 • of the supplied arrays contains a blank or a non-numeric value • 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, e.g. in the example above, had we highlighted cells G5-H5 while entering the MMULT function, those cells, not being part of the resulting matrix, will return the #N/A error

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.  For the following matrices:

The matrix product array of the two arrays above, A & B is calculated as:

where is the row number, and is the column number.

The following represents the matrix product calculation: