A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Calculating Sum Series



 
 
Thread Tools Display Modes
  #1  
Old April 21st, 2010, 07:51 AM posted to microsoft.public.excel.misc
deluth
external usenet poster
 
Posts: 3
Default Calculating Sum Series

Greetings,

I can't seem to find a formula to do series of sums. I would like to
calculate the following series:

For n = 0 to n=B1/B3
sum: (A1+(A2*n))*A3

Thank you for your help.

Deluth
  #2  
Old April 21st, 2010, 08:03 AM posted to microsoft.public.excel.misc
Joe User[_2_]
external usenet poster
 
Posts: 757
Default Calculating Sum Series

"deluth" wrote:
I can't seem to find a formula to do series of sums.
I would like to calculate the following series:
For n = 0 to n=B1/B3
sum: (A1+(A2*n))*A3


I responded to your posting in the same "discussion group" 11 hours earlier.

I wrote....

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
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


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


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