Re: Summing values in a range



On Sun, Jan 27, 2002 at 12:30:01PM -0700, z thompson wrote:

A       B       C
0       3       0
1       5       2


What I would like to do is:

(sum of row x + 1) - (sum of row x) = y

and then get the sum of the integers from 0 to y. So, essentially it would
be:

(1 + 5 + 2) - ( 0 + 3 + 0) = 5     sum of 0 to 5 = 0 + 1 + 2 + 3 + 4 + 5
= 15


Getting the difference between the rows is trivial. However, is there
a predefined function for summing the range 0 to y? If not, how could I
go about doing this?

Doing the initial difference is trivial
sum(A2:C2)-sum(A1:C1)

Getting the sum of integers 1..n is a standard math problem.
 = n(n+1)/2



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]