![]() |
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 |
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 |
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 |
All times are GMT +1. The time now is 05:26 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com