WorksheetFunction.MMult method (Excel)

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

expression.MMult (Arg1, Arg2)

expression A variable that represents a WorksheetFunction object.

Parameters

Name Required/Optional Data type Description
Arg1 - Arg2 Required Variant Array1, array2 - the arrays you want to multiply.

Return value

Variant

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 size of the resulting array is equal to or greater than a total of 5,461 cells.

The matrix product array a of two arrays b and c is as follows, where i is the row number, and j is the column number:

Formula

Formulas that return arrays must be entered as array formulas.

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.