Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Spreadsheet
 
Posts: n/a
Default Summing a function


Is there a way to write a function, specify a range of integers, and
have Excel return the sum of the function evaluated at each integer?
The only way that I know how to do this is to actually create a list
with every integer and the corresponding value of the funciton at that
integer and then sum the list. This is not a good idea, however, when
the number of integers is in the thousands. Is there any way to get
around this?


--
Spreadsheet
------------------------------------------------------------------------
Spreadsheet's Profile: http://www.excelforum.com/member.php...o&userid=34730
View this thread: http://www.excelforum.com/showthread...hreadid=547480

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Gary L Brown
 
Posts: n/a
Default Summing a function

- How do you know which integers you want to sum?
- Are the integers all in one column?



"Spreadsheet" wrote:


Is there a way to write a function, specify a range of integers, and
have Excel return the sum of the function evaluated at each integer?
The only way that I know how to do this is to actually create a list
with every integer and the corresponding value of the funciton at that
integer and then sum the list. This is not a good idea, however, when
the number of integers is in the thousands. Is there any way to get
around this?


--
Spreadsheet
------------------------------------------------------------------------
Spreadsheet's Profile: http://www.excelforum.com/member.php...o&userid=34730
View this thread: http://www.excelforum.com/showthread...hreadid=547480


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Spreadsheet
 
Posts: n/a
Default Summing a function


I want the sum of the function evaluated at a range of integers. I want
to be able to specify the range of integers as a paramater of the
function. For example, suppose there is some function that does what I
want called SUMFUNC.

SUMFUNC(X^2,1,10) would return the sum of squares from 1 to 10 (i.e.
1+4+9+16+...+100).

Or maybe if I have two cells, with the starting integer in A1 and the
ending integer in A2 the funciton would look as follows:
SUMFUCNC((A1:A2)^2). This would also return 1+4+9+...+100.

I just made this up as an example and I'm sure that there is no easy
solution like this. But if anybody has any ideas, please let me know.


--
Spreadsheet
------------------------------------------------------------------------
Spreadsheet's Profile: http://www.excelforum.com/member.php...o&userid=34730
View this thread: http://www.excelforum.com/showthread...hreadid=547480

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Gary L Brown
 
Posts: n/a
Default Summing a function

I don't believe any such function exists. You'd have to create a
User-Defined-Funtion.

--
Gary Brown
"Spreadsheet" wrote:


I want the sum of the function evaluated at a range of integers. I want
to be able to specify the range of integers as a paramater of the
function. For example, suppose there is some function that does what I
want called SUMFUNC.

SUMFUNC(X^2,1,10) would return the sum of squares from 1 to 10 (i.e.
1+4+9+16+...+100).

Or maybe if I have two cells, with the starting integer in A1 and the
ending integer in A2 the funciton would look as follows:
SUMFUCNC((A1:A2)^2). This would also return 1+4+9+...+100.

I just made this up as an example and I'm sure that there is no easy
solution like this. But if anybody has any ideas, please let me know.


--
Spreadsheet
------------------------------------------------------------------------
Spreadsheet's Profile: http://www.excelforum.com/member.php...o&userid=34730
View this thread: http://www.excelforum.com/showthread...hreadid=547480


  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Herbert Seidenberg
 
Posts: n/a
Default Summing a function

The list of integers could be hidden as an array name.
If the integers are {1,2,3,4,5,6,7,8,9,10}
then Start (A1=1) and End (A2=10) define this list named Seqn
Insert Name Define
Seqn Refers To: =ROW(INDEX(A:A,Start):INDEX(A:A,End))
The sum of the squares is then
=SUMPRODUCT(Seqn^2) =385
With the use of Mod and Int, etc, Seqn can be built up to any
complexity you want.



  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Daniel Erwin
 
Posts: n/a
Default Summing a function

How about using this array formula:
=sum(row(1:10)^2)
You may change the numbers to suit your needs.

Regards,
Daniel

  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Daniel Erwin
 
Posts: n/a
Default Summing a function


Or maybe if I have two cells, with the starting integer in A1 and the
ending integer in A2 the funciton would look as follows:
SUMFUCNC((A1:A2)^2). This would also return 1+4+9+...+100.


Let's see A1 for first integer, and B1 as last integer, use this array
formula:
=SUM(ROW(INDIRECT("A"&INDIRECT("A1")&":B"&INDIRECT ("B1")))^2)

Regards,
Daniel

  #8   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Dana DeLouis
 
Posts: n/a
Default Summing a function

Let's see A1 for first integer, and B1 as last integer...
=SUM(ROW(INDIRECT("A"&INDIRECT("A1")&":B"&INDIRECT ("B1")))^2)


Hi. For this particular equation, another option might be:

=(A1*((3-2*A1)*A1-1)+B1*(B1+1)*(2*B1+1))/6

as the sum from 1 to n 'squared' is n*(1 + n)*((1 + 2*n)/6)
--
HTH. :)
Dana DeLouis
Windows XP, Office 2003


"Daniel Erwin" wrote in message
oups.com...

Or maybe if I have two cells, with the starting integer in A1 and the
ending integer in A2 the funciton would look as follows:
SUMFUCNC((A1:A2)^2). This would also return 1+4+9+...+100.


Let's see A1 for first integer, and B1 as last integer, use this array
formula:
=SUM(ROW(INDIRECT("A"&INDIRECT("A1")&":B"&INDIRECT ("B1")))^2)

Regards,
Daniel



  #9   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Spreadsheet
 
Posts: n/a
Default Summing a function


Thanks Daniel,

I got the array formula to work, although it didn't work until I
Ctrl-Shift-Entered it.


--
Spreadsheet
------------------------------------------------------------------------
Spreadsheet's Profile: http://www.excelforum.com/member.php...o&userid=34730
View this thread: http://www.excelforum.com/showthread...hreadid=547480

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA Monty Excel Worksheet Functions 2 January 30th 06 01:37 PM
Date & Time mully New Users to Excel 4 May 23rd 05 11:56 AM
Hyperlinks using R[1]C[1] and offset function in its cell referenc Elijah-Dadda Excel Worksheet Functions 0 March 5th 05 03:31 AM
Conversion SVC Excel Worksheet Functions 9 February 28th 05 02:29 PM
HOW CAN I GET OFFICE 2003 EXCEL BASIC TO NEST FUNCTIONS LIKE EXCE. Robert AS Excel Worksheet Functions 4 December 2nd 04 10:49 AM


All times are GMT +1. The time now is 05:50 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"