Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default How to program a series sum function

Hi there !

I want to create a math function that can emulate a series sum of any
kind, for instance:

series sum for i=1 to n (1/(i+2)^+B2) or whatever.

For what I have seen in the help menu, there is a seriesum function
but is a standard sin/cos series function and I couldn't find anything
else.

Can anyone help me doing this ?

Thanks/brgds
jj
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default How to program a series sum function

Joao,

You can use a User-Defined-Function, see sample code below. Of course, you
will need to make it a little smarter if you want to use cell references for
parameters. Used like

=SeriesSum(B2,100)

where B2 has the string, for example,

1/(i+2)^2

This would return the sum for 1 = 1 to 100 of 1/(i+2)^2

HTH,
Bernie
MS Excel MVP

Function SeriesSum(Arg As String, N As Integer) As Double
Dim i As Integer
For i = 1 To N
SeriesSum = SeriesSum + Evaluate(Replace(Arg, "i", i))
Next i
End Function



"Joao" wrote in message
om...
Hi there !

I want to create a math function that can emulate a series sum of any
kind, for instance:

series sum for i=1 to n (1/(i+2)^+B2) or whatever.

For what I have seen in the help menu, there is a seriesum function
but is a standard sin/cos series function and I couldn't find anything
else.

Can anyone help me doing this ?

Thanks/brgds
jj



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default How to program a series sum function

Thanks Bernie - great help.
Brgds
Joao

"Bernie Deitrick" <deitbe @ consumer dot org wrote in message ...
Joao,

You can use a User-Defined-Function, see sample code below. Of course, you
will need to make it a little smarter if you want to use cell references for
parameters. Used like

=SeriesSum(B2,100)

where B2 has the string, for example,

1/(i+2)^2

This would return the sum for 1 = 1 to 100 of 1/(i+2)^2

HTH,
Bernie
MS Excel MVP

Function SeriesSum(Arg As String, N As Integer) As Double
Dim i As Integer
For i = 1 To N
SeriesSum = SeriesSum + Evaluate(Replace(Arg, "i", i))
Next i
End Function



"Joao" wrote in message
om...
Hi there !

I want to create a math function that can emulate a series sum of any
kind, for instance:

series sum for i=1 to n (1/(i+2)^+B2) or whatever.

For what I have seen in the help menu, there is a seriesum function
but is a standard sin/cos series function and I couldn't find anything
else.

Can anyone help me doing this ?

Thanks/brgds
jj

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
How to program an excel macro to repeat a series of keystrokes? Beancounter Excel Discussion (Misc queries) 8 January 22nd 05 11:51 PM
The 'DATEDIF' Function is not listed on my Excel program. UOF Excel Worksheet Functions 7 January 5th 05 09:29 AM
Using the Excel TEXT function within a VBA program [email protected] Excel Programming 1 February 17th 04 05:06 PM
merging excel program with tdc finance program judy Excel Programming 0 November 5th 03 08:01 PM
program a function key John Sheakley Excel Programming 1 September 30th 03 02:31 AM


All times are GMT +1. The time now is 05:42 PM.

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

About Us

"It's about Microsoft Excel"