ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Summation over a range (https://www.excelbanter.com/excel-worksheet-functions/159147-summation-over-range.html)

P25_Sys_Arch

Summation over a range
 
Does anyone know of an easy way to sum a function over a range of values such
as from k=0 to k=N, where N is a variable in a cell?

Thanks,
--
P25 System Architect

Peo Sjoblom

Summation over a range
 
=SUM(C1:INDEX(C:C,B1))


where B1 holds the variable and C is the column you want to sum based on the
variable


--


Regards,


Peo Sjoblom



"P25_Sys_Arch" wrote in message
...
Does anyone know of an easy way to sum a function over a range of values
such
as from k=0 to k=N, where N is a variable in a cell?

Thanks,
--
P25 System Architect




David Hilberg

Summation over a range
 
If you want to do it all in one cell, you can hack the row function
into a counter:

Row(1:10)
Row(Indirect("1:" & A1))

E.g., to sum the first 10 terms of the harmonic series, with 10 in A1:

=SUM(1/ROW(INDIRECT("1:" & A1)))

array-entered with Ctrl+Shift+Enter, so that Excel bounds the formula
with braces { }, otherwise only the first value in Row will be used.

Note that you cannot use 0 in this counter, as Excel has no 0th row.

- David



On Sep 20, 3:46 pm, P25_Sys_Arch
wrote:
Does anyone know of an easy way to sum a function over a range of values such
as from k=0 to k=N, where N is a variable in a cell?

Thanks,
--
P25 System Architect





All times are GMT +1. The time now is 07:28 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com