Table of Contents
Matrix multiplication is a fundamental operation in linear algebra, essential for tasks ranging from solving systems of linear equations to complex data transformations used in statistics and machine learning. Historically, performing these calculations manually or even using standard spreadsheet operations could be time-consuming and prone to error. Fortunately, modern tools like Google Sheets provide powerful, built-in functions that streamline this process, allowing users to handle intricate calculations with precision and efficiency.
The ability to perform matrix multiplication directly within a spreadsheet environment makes Google Sheets an excellent platform for quick prototyping, financial modeling, and academic work. Instead of relying on manual cell-by-cell calculations—which require meticulous tracking of rows, columns, and sums of products—we can leverage a dedicated function. This capability significantly reduces the complexity associated with handling large datasets or matrices with numerous dimensions.
This detailed guide will walk you through utilizing the specific function designed for this purpose in Google Sheets: MMULT. We will examine its structure, review the essential mathematical prerequisites required for valid multiplication, and demonstrate its application through practical, step-by-step examples involving various matrix sizes.
Introduction to the MMULT Function
To efficiently execute matrix multiplication in Google Sheets, you must utilize the MMULT function. This function is specifically designed to calculate the matrix product of two arrays or cell ranges. The process is straightforward: identify the two matrices you wish to multiply, specify their respective cell ranges as arguments within the function, and Google Sheets automatically handles the underlying mathematical operations based on the rules of linear algebra.
The functionality of MMULT is powerful because it allows for dynamic array outputs. Unlike many standard spreadsheet formulas that only return a single value, MMULT returns an entire resulting matrix that spills into the required number of cells, provided the output range is clear. This makes it an ideal tool for users who frequently work with vector mathematics or covariance matrices. Understanding the input requirements—specifically, the dimensional compatibility—is the key to mastering this function.
It is crucial to remember that the output of the MMULT function will automatically populate an array of cells equivalent to the resulting matrix’s size. For example, if you multiply a 2×3 matrix by a 3×4 matrix, the result will be a 2×4 matrix, automatically occupying 8 cells in the designated output area. This automatic array handling is one of the most significant advantages when working with complex array formulas in Google Sheets.
You can use the MMULT function in Google Sheets to perform matrix multiplication quickly and accurately.
Understanding the MMULT Function Syntax
The MMULT function follows a very simple and specific structure, requiring only two arguments, which represent the two matrices intended for multiplication.
This function uses the following basic syntax:
MMULT(matrix1, matrix2)
where:
- matrix1: The first matrix in the multiplication operation. This must be a cell range (e.g., A1:B2).
- matrix2: The second matrix in the multiplication operation. This must also be a cell range (e.g., C1:D2).
For the multiplication to be valid, the number of columns in matrix1 must precisely match the number of rows in matrix2. If these inner dimensions do not match, the function will return an error, typically #VALUE!, indicating an incompatible array size.
The following examples illustrate how to use the MMULT function to perform various standard matrix multiplications in Google Sheets, showcasing how the function adapts to different input dimensions:
- Multiplication of a Square Matrix by a Square Matrix (2×2) by (2×2)
- Multiplication of a Square Matrix by a Rectangular Matrix (2×2) by (2×3)
- Multiplication of a Larger Square Matrix by a Rectangular Matrix (3×3) by (3×2)
Example 1: Multiplying Two Square Matrices (2×2 by 2×2)
This first example demonstrates the multiplication of two square matrices, specifically two 2×2 matrices. This setup is the simplest form of matrix multiplication where both the number of rows and columns are equal between the input matrices. Since the number of columns in the first matrix (2) equals the number of rows in the second matrix (2), the operation is valid, and the resulting matrix will also be a 2×2 array.
The following screenshot illustrates the setup where Matrix A (2×2) is defined in range A2:B3, and Matrix B (2×2) is defined in range D2:E3. The output is calculated starting in cell G2:

To calculate the product of these two matrices, we entered the following MMULT formula into cell G2. Google Sheets automatically populated the four required output cells (G2, G3, H2, and H3) with the resulting matrix elements:
=MMULT(A2:B3, D2:E3)
This formula instructs the spreadsheet to multiply the array defined by the orange boundary (A2:B3) by the array defined by the purple boundary (D2:E3). For reference, here are the underlying calculations that Google Sheets performed element by element to achieve the final result:

Executing the MMULT function with the specified ranges yields the following 2×2 resultant matrix, displayed in the output range G2:H3:

Example 2: Multiplying Matrices with Different Column Counts (2×2 by 2×3)
Our second example explores a scenario where the two matrices have differing outer dimensions. We will multiply a 2×2 matrix (Matrix A) by a 2×3 matrix (Matrix B). Crucially, the inner dimensions are compatible (Matrix A has 2 columns, and Matrix B has 2 rows). Therefore, the resulting product matrix will inherit the rows of the first matrix (2) and the columns of the second matrix (3), yielding a 2×3 output matrix.
The following screenshot illustrates this multiplication. Matrix A remains in range A2:B3 (2×2), while the expanded Matrix B is now defined across range D2:F3 (2×3). The output array starts in cell H2:

We entered the following formula in cell H2 to perform this specific matrix multiplication. Note that the output range must accommodate the 2 rows and 3 columns of the resultant matrix:
=MMULT(A2:B3, D2:F3)
The MMULT function handles the necessary calculations across the 2×2 and 2×3 input matrices. Since Matrix B has an additional column compared to the previous example, the calculation generates an extra column of results. The output seamlessly expands to fit the 2×3 structure:

This execution results in the following 2×3 matrix, which occupies the cell range H2:J3:

Example 3: Multiplying Larger Matrices (3×3 by 3×2)
For our final example, we will scale up the operation by multiplying a 3×3 square matrix (Matrix A) by a 3×2 rectangular matrix (Matrix B). Again, we confirm the validity: Matrix A has 3 columns, and Matrix B has 3 rows—a perfect match for matrix multiplication. The resulting product matrix will inherit the 3 rows of Matrix A and the 2 columns of Matrix B, producing a 3×2 output array.
The following screenshot displays the larger setup. Matrix A is defined in the range A2:C4 (3×3), and Matrix B is defined in E2:F4 (3×2). The resulting product matrix is calculated starting in cell H2:

We entered the following MMULT formula in cell H2 to execute this calculation. The formula clearly specifies the two larger array ranges:
=MMULT(A2:C4, E2:F4)
The complexity of the calculation increases significantly with larger matrices, but Google Sheets handles the multiplication seamlessly. The output array now contains 6 total elements (3 rows by 2 columns), occupying the cell range H2:I4. Here are the specific formulas used by Google Sheets to calculate each element of the resulting product matrix:

This operation successfully generates the following 3×2 output matrix:

Key Takeaways and Further Resources
The MMULT function provides a robust and efficient mechanism for performing matrix multiplication within Google Sheets, circumventing the need for manual array operations. The most critical factor in successful execution is ensuring the dimensional compatibility of the input matrices: the number of columns in the first matrix must match the number of rows in the second matrix. If this requirement is met, the function automatically spills the resulting array into the designated output range.
Mastering the use of MMULT significantly enhances the analytical capabilities of Google Sheets for anyone working with data that relies on linear algebra principles, such as calculating eigenvectors, solving complex financial models, or performing statistical regressions. Always verify your input ranges and ensure the output area is clear to prevent the formula from returning a #REF! error due to insufficient space.
Note: You can find the complete official documentation for the MMULT function in Google Sheets on the official Google Support website. Reviewing the formal documentation can provide additional technical details regarding error handling and array requirements.
Cite this article
stats writer (2025). How to Perform Matrix Multiplication in Google Sheets: A Step-by-Step Guide. PSYCHOLOGICAL SCALES. Retrieved from https://scales.arabpsychology.com/stats/im-trying-to-perform-a-matrix-multiplication-in-google-sheets/
stats writer. "How to Perform Matrix Multiplication in Google Sheets: A Step-by-Step Guide." PSYCHOLOGICAL SCALES, 21 Nov. 2025, https://scales.arabpsychology.com/stats/im-trying-to-perform-a-matrix-multiplication-in-google-sheets/.
stats writer. "How to Perform Matrix Multiplication in Google Sheets: A Step-by-Step Guide." PSYCHOLOGICAL SCALES, 2025. https://scales.arabpsychology.com/stats/im-trying-to-perform-a-matrix-multiplication-in-google-sheets/.
stats writer (2025) 'How to Perform Matrix Multiplication in Google Sheets: A Step-by-Step Guide', PSYCHOLOGICAL SCALES. Available at: https://scales.arabpsychology.com/stats/im-trying-to-perform-a-matrix-multiplication-in-google-sheets/.
[1] stats writer, "How to Perform Matrix Multiplication in Google Sheets: A Step-by-Step Guide," PSYCHOLOGICAL SCALES, vol. X, no. Y, ص Z-Z, November, 2025.
stats writer. How to Perform Matrix Multiplication in Google Sheets: A Step-by-Step Guide. PSYCHOLOGICAL SCALES. 2025;vol(issue):pages.
