At 05:16 PM Wednesday 7/13/2005, Alberto Monteiro wrote:
I have two columns - let's call them A and Z - and I want to calculate
what would in any decent programming language be the sum
of f(A[i], Z[i]) [where f is a given function]. Is there any way I can
do this?
The simplest and most obvious way which comes to mind is to do it in two steps:
(1) Create a third column, which we'll call B, which contains the results
of the function applied to the elements in each row, i.e., B[i] = f(A[i],
Z[i]).
(2) Use the SUM function (Insert > Function > Math & Trig) to sum the
desired range of elements in column B. Frex, if the range of i is from i=5
to i=20, SUM(B5:B20) will sum those elements.
Depending on the exact nature of your function f, you may find useful
information in the "Help" entries for SUMPRODUCT, SERIESSUM, etc . . . In
particular, there a number of built-in functions which do the kinds of sums
often encountered in statistics, e.g., the sum of X[i]^2, the sum of
X[i]*Y[i], etc, as well as things like SUMIF, which sums only those
elements in the range which meet a given conditional.
HTH.
-- Ronn! :)
_______________________________________________
http://www.mccmedia.com/mailman/listinfo/brin-l