#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 6
Default Calculating a Series

Please help me put together a function to calculate a sum series as follows:
For n = 0 to n=(B3-B1): sum ((A1 + (A3*n)) * A6)

Thank you,
Deluth
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 905
Default Calculating a Series

"deluth" wrote:
Please help me put together a function to calculate
a sum series as follows:
For n = 0 to n=(B3-B1): sum ((A1 + (A3*n)) * A6)


Well, you could write the following UDF. Note that the variable names a1,
a3, etc do not have to match the cell names. I use them just to help you
relate to the above formula. You can call the UDF from Excel with any cells;
for example: =mysum(A1,A3,A6,B1,B3)

However, note that the series sum can be reduced to a single algebraic
formula. So instead of the UDF, you can write:

=A6* (A1*(B3-B1+1) + A3*(B3-B1)*(B3-B1+1)/2)

which can be simplified further to:

=A6 * (B3-B1+1) * (A1+A3*(B3-B1)/2)

UDF....

Option Explicit
Function mysum(a1 As Double, a3 As Double, _
a6 As Double, b1 As Double, b3 As Double) _
As Double
Dim s As Double, n As Double
s = 0
For n = 0 To b3 - b1
s = s + (a1 + (a3 * n)) * a6
Next
mysum = s
End Function
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
Calculating largest gap in a series of consecutive numbers Samuel Excel Worksheet Functions 6 March 29th 09 11:52 PM
User Selectable Series and Number of Series for Line Chart Dave in NJ Charts and Charting in Excel 2 February 23rd 09 12:18 AM
Fill Series Dates: not letting me change the series from year to m Mike Excel Discussion (Misc queries) 1 January 24th 08 05:08 PM
chart data series -- plot a table as a single series hjc Charts and Charting in Excel 7 September 20th 05 05:52 PM
series graph -- one series being added to another series rich zielinski via OfficeKB.com Charts and Charting in Excel 3 March 30th 05 06:23 PM


All times are GMT +1. The time now is 10:49 PM.

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"