Thursday, 12 December 2013

SUM function and the SUM function along with Array.



The SUM function adds all the numbers that you specify as arguments. Each argument can be range , a cell reference, an array , a constant, a formula , or the result from another function.

Syntax : 
SUM (number1, [number2] , ...])

Examples:
=SUM(1,2,3)
Result: 6

=SUM(A1:A3)
Result would be the sum of value in A1,A2 and A3.

=SUM(A1:A3,5)
Result would be the sum of value in A1, A2, A3 and 5.

=SUM(A1,A3,5)
Result would be the sum of value in A1 , A3 and 5.

=SUM("5",15,true)
 Result : 16. Here first text 5 would be converted to number, then add with value 15 and the logical  value for TRUE is 1. Instead of TRUE, if it is FALSE, then the logical value assigned for FALSE is 0 and the result would be 15.

 
SUM function with Array:

Examples:-

Array constant is :{1,2,3,4,5}
=SUM({1,2,3,4,5})
is same as
=SUM(1,2,3,4,5)
 Result would be 15.

  Array constant is : {1,2,3,4,5} and {6,7,8,9,10}
=SUM({1,2,3,4,5}*{6,7,8,9,10})
is similar to
=SUM(1*6 , 2*7, 3*8, 4*9, 5*10)
Result: 130
 
 Array Constant is: {1,2,3,4,5}
=SUM(A1:A5,{1,2,3,4,5})
is similar to
=SUM(A1*1, A2*2, A3*3, A4*4, A5*5)

 Array constant is {1,2,3,TRUE}
=SUM({1,2,3,TRUE}^2)
Result : 15

Array constant is {1,2,TRUE} and {FALSE,4,6}
=SUM({1,2,TRUE}*{FALSE,4,6})
Result : 14

No comments:

Post a Comment