In this article:

Google Sheets Dot Product (How to Calculate It in 2024)

December 5, 2024

Google Sheets Dot Product

In Google Sheets, the dot product of two vectors can be calculated using the MMULT and TRANSPOSE functions together. The dot product, a key operation in linear algebra, involves multiplying corresponding entries of two vectors and then summing those products. 

It's used in various fields, including mathematics, physics, and engineering, to calculate the similarity between vectors, project one vector onto another, or find the angle between vectors, among other applications.

Syntax

Below is the formula syntax for calculating the dot product of two vectors, A and B:

=MMULT(TRANSPOSE(A1:A4), B1:B4)

In this formula, A1:A4 represents the range of the first vector and B1:B4 represents the range of the second vector. The TRANSPOSE function changes the row vector A into a column vector. This allows the MMULT function to perform matrix multiplication which results in the dot product of vectors A and B.

Make sure to replace A1:A4 and B1:B4 with the actual cell ranges of your vectors. Note that for MMULT to work as expected, both vectors should have the same dimension, i.e., the same number of elements.

How to Calculate Dot Product in Google Sheets

Follow the steps below to calculate dot product in Google Sheets. 

1. Input Vectors A and B into Google Sheets

For our example, we have listed vector A's components into cells A1 through A4 and vector B's components into cells B1 through B4.

google sheets dot product

2. Select a Cell for the Dot Product Result

Find an empty cell where the dot product calculation will be displayed. This cell is where you will input the formula to calculate the dot product.

3. Input the Dot Product Formula

In the cell selected for the dot product result, type the formula =MMULT(TRANSPOSE(A1:A4), B1:B4). This formula tells Google Sheets to multiply the transpose of vector A (cells A1 to A4) by vector B (cells B1 to B4), which computes their dot product.

Image Placeholder

4. Execute the Formula by Pressing Enter

Press Enter to execute the formula. Google Sheets will calculate the dot product of vectors A and B. 

5. Review the Dot Product Calculation Result

The resulting value in the cell is the dot product of vectors A and B, calculated by summing the products of their corresponding components. The dot product result of 33 suggests that vectors A and B are somewhat aligned, indicating they point in roughly the same direction. A positive value like this also implies the angle between them is less than 90 degrees which highlights a degree of similarity or correlation between the vectors.

We hope that you now have a better understanding of how to calculate dot product in Google Sheets. If you enjoyed this article, you might also like our article on how to convert radians to degrees in Google Sheets or our article on how to get dividend yield in Google Sheets.

Get Google Sheets productivity and automation tips delivered straight to your inbox
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
We'll email you 1-3 times a week — and never share your information.

Work less, automate more!

Use Lido to connect your spreadsheets to email, Slack, calendars, and more to automate data transfers and eliminate manual copying and pasting. View all use cases ->