MMULT function

This article describes the formula syntax and usage of the MMULT function (function: A prewritten formula that takes a value or values, performs an operation, and returns a value or values. Use functions to simplify and shorten formulas on a worksheet, especially those that perform lengthy or complex calculations.) in Microsoft Excel.

Description

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)

The MMULT function syntax has the following arguments (argument: A value that provides information to an action, an event, a method, a property, a function, or a procedure.):

  • Array1, array2    Required. 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.
  • MMULT returns the #VALUE! error when:
    • Any cells are empty or contain text.
    • The number of columns in array1 is different from the number of rows in array2.
  • The matrix product array a of two arrays b and c is:

Equation

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

  • Formulas that return arrays must be entered as array formulas.

 Note    In Excel Web App you cannot create array formulas.

Example

Example 1

The example may be easier to understand if you copy it to a blank worksheet.

ShowHow do I copy an example?

  1. Select the example in this article. If you are copying the example in Excel Web App, copy and paste one cell at a time.Important Do not select the row or column headers.

Selecting an example from Help

Selecting an example from Help

  1. Press CTRL+C.
  2. Create a blank workbook or worksheet.
  3. In the worksheet, select cell A1, and press CTRL+V. If you are working in Excel Web App, repeat copying and pasting for each cell in the example.

Important For the example to work properly, you must paste it into cell A1 of the worksheet.

  1. To switch between viewing the results and viewing the formulas that return the results, press CTRL+` (grave accent), or on the Formulas tab, in the Formula Auditing group, click the Show Formulas button.

After you copy the example to a blank worksheet, you can adapt it to suit your needs.

 
1
2
3
4
5
6
7
8
A B
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 worksheet, 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 worksheet.

ShowHow do I copy an example?

  1. Select the example in this article. If you are copying the example in Excel Web App, copy and paste one cell at a time.Important Do not select the row or column headers.

Selecting an example from Help

Selecting an example from Help

  1. Press CTRL+C.
  2. Create a blank workbook or worksheet.
  3. In the worksheet, select cell A1, and press CTRL+V. If you are working in Excel Web App, repeat copying and pasting for each cell in the example.

Important For the example to work properly, you must paste it into cell A1 of the worksheet.

  1. To switch between viewing the results and viewing the formulas that return the results, press CTRL+` (grave accent), or on the Formulas tab, in the Formula Auditing group, click the Show Formulas button.

After you copy the example to a blank worksheet, you can adapt it to suit your needs.

 
1
2
3
4
5
6
7
8
A B
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 in the Excel desktop application. After copying the example to a blank worksheet, 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.

 
 
Applies to:
Excel 2010, Excel Web App, SharePoint Online for enterprises, SharePoint Online for professionals and small businesses