Difference between revisions of "Documentation/How Tos/Calc: SUMPRODUCT function"
From Apache OpenOffice Wiki
< Documentation | How Tos
(removed image; and other edits) |
(→Syntax:) |
||
Line 8: | Line 8: | ||
: <tt>'''array1'''</tt> to <tt>'''array30'''</tt> are up to 30 arrays or ranges of the same size whose corresponding elements are to be multiplied. | : <tt>'''array1'''</tt> to <tt>'''array30'''</tt> are up to 30 arrays or ranges of the same size whose corresponding elements are to be multiplied. | ||
− | :<tt>'''SUMPRODUCT'''</tt> returns [[Image:Calc_sumproduct_equation.png]] for the <i>i</i> elements in the arrays | + | :<tt>'''SUMPRODUCT'''</tt> returns [[Image:Calc_sumproduct_equation.png]] for the <i>i</i> elements in the arrays. |
: You can use <tt>'''SUMPRODUCT'''</tt> to calculate the scalar product of two vectors. | : You can use <tt>'''SUMPRODUCT'''</tt> to calculate the scalar product of two vectors. | ||
+ | |||
+ | |||
+ | :<i>Advanced topic:</i> | ||
+ | |||
+ | :<tt>'''SUMPRODUCT'''</tt> evaluates each parameter <tt>'''array1'''</tt> to <tt>'''array30'''</tt> as an [[Documentation/How_Tos/Using Arrays|array formula]], but does not need to be entered as an array formula. In other words it can be entered with the '''Enter''' key, rather than '''Cntrl-Shift-Enter'''. See the example below. | ||
: <tt>'''SUMPRODUCT'''</tt> can also be used to sum cells where a specified condition is true - see '''[[Documentation/How_Tos/Conditional Counting and Summation|Conditional Counting and Summation]]''' and the example below. | : <tt>'''SUMPRODUCT'''</tt> can also be used to sum cells where a specified condition is true - see '''[[Documentation/How_Tos/Conditional Counting and Summation|Conditional Counting and Summation]]''' and the example below. |
Revision as of 18:13, 7 May 2008
SUMPRODUCT
Returns the sum of the products of corresponding array elements.
Syntax:
SUMPRODUCT(array1; array2; ... array30)
- array1 to array30 are up to 30 arrays or ranges of the same size whose corresponding elements are to be multiplied.
- You can use SUMPRODUCT to calculate the scalar product of two vectors.
- Advanced topic:
- SUMPRODUCT evaluates each parameter array1 to array30 as an array formula, but does not need to be entered as an array formula. In other words it can be entered with the Enter key, rather than Cntrl-Shift-Enter. See the example below.
- SUMPRODUCT can also be used to sum cells where a specified condition is true - see Conditional Counting and Summation and the example below.
Example:
SUMPRODUCT(A1:B2; F1:G2)
- returns A1*F1 + B1*G1 + A2*F2 + B2*G2.
SUMPRODUCT(A1:A6=”red”; B1:B6=”big”; C1:C6)
- returns the sum of cells in C1:C6 whose corresponding entries in the A column are red and in the B column are big.
See also:
SUM, SUMIF, SUMSQ, SUMX2MY2, SUMX2PY2, SUMXMY2