Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Excel: Scalar product of two ranges

I am trying to find a proper way to calculate the scalar product of two ranges. For instance, the product of A1:A3 and B1:B3 would be A1*B1 + A2*B2 + A3*B3. Is there a good way to do this? Hardcoding this calculation is quite a tedious thing to do with large ranges.

like image 588
Lee White Avatar asked Mar 28 '14 14:03

Lee White


People also ask

Is dot product the same as SUMPRODUCT?

The dot product is the sum of the product of two vectors. For example, two vectors are v1 = [2, 3, 1, 7] and v2 = [3, 6, 1, 5]. The sum of the product of two vectors is 2 × 3 + 3 × 6 + 1 × 1 = 60. We can use the = SUMPRODUCT(Array1, Array2) function to calculate dot product in excel.

How do you multiply an array by a scalar in Excel?

Select the cell with the constant number (B1), and press Ctrl + C to copy it to the clipboard. Select the cells you want to multiply (C4:C7). Press Ctrl + Alt + V, then M, which is the shortcut for Paste Special > Multiply, and then press Enter.

Is there a SUMPRODUCT for division?

The SUMPRODUCT function returns the sum of the products of corresponding ranges or arrays. The default operation is multiplication, but addition, subtraction, and division are also possible.


1 Answers

Use this one

=SUMPRODUCT(A1:A3,B1:B3) 
like image 119
Dmitry Pavliv Avatar answered Oct 05 '22 18:10

Dmitry Pavliv