#1   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 1
Default Sigma sums

I'm looking for a formula to do sums, but the "sigma"
kind of sum (iterating over a formula and summing the
results), not the SUM() function kind of sums (summing
over a range of cells). For example, if cell A1
contains the number of iterations, A2 contains some
constant, and my formula is 1 + $A$2 * (i - 1), where
i is the counter from 1 to $A$1, I want something like
the following pseudocode.

int sum = 0;
for (int i = 1; i <= $A$1; i++) {
sum = sum + (1 + $A$2 * (i - 1));
}

Does that make sense?

Thanks for any help.
  #2   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 2,722
Default Sigma sums

The easiest way may be to simply create a UDF. (user-defined-function). Open
up the VBE (Visual Basic Editor) by pressing Alt+F11. Now, we need a blank
module, so go to Insert, Module. Paste the following in:


'=========================
Function SigmaSum(StartValue As Integer, _
EndValue As Integer, Constant As Variant) As Variant

SigmaSum = 0
For i = StartValue To EndValue
SigmaSum = SigmaSum + (1 + Constant * (i - 1))
Next
End Function
'=========================



Close the VBE. Back in your workbook, your formula becomes:
=SigmaSum(1,$A$1,$A$2)
--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"Larry Coon" wrote:

I'm looking for a formula to do sums, but the "sigma"
kind of sum (iterating over a formula and summing the
results), not the SUM() function kind of sums (summing
over a range of cells). For example, if cell A1
contains the number of iterations, A2 contains some
constant, and my formula is 1 + $A$2 * (i - 1), where
i is the counter from 1 to $A$1, I want something like
the following pseudocode.

int sum = 0;
for (int i = 1; i <= $A$1; i++) {
sum = sum + (1 + $A$2 * (i - 1));
}

Does that make sense?

Thanks for any help.

  #3   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 1,104
Default Sigma sums

If A1 = 5 and A2 =2, then
=1+SUMPRODUCT(A2*ROW(1:100)*(ROW(1:100)<A1))
will compute
1+ (2+4+6+8) = 21

If A1 is 100, adjust the 100 in the formula to a larger value
Any use?
best wishes
--
Bernard V Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
remove caps from email


"Larry Coon" wrote in message
...
I'm looking for a formula to do sums, but the "sigma"
kind of sum (iterating over a formula and summing the
results), not the SUM() function kind of sums (summing
over a range of cells). For example, if cell A1
contains the number of iterations, A2 contains some
constant, and my formula is 1 + $A$2 * (i - 1), where
i is the counter from 1 to $A$1, I want something like
the following pseudocode.

int sum = 0;
for (int i = 1; i <= $A$1; i++) {
sum = sum + (1 + $A$2 * (i - 1));
}

Does that make sense?

Thanks for any help.



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
如何加總算出sigma(1到n) jefferson Excel Worksheet Functions 1 September 12th 08 06:13 AM
sigma function smerk Excel Worksheet Functions 1 April 23rd 08 03:31 PM
Add ins for Six Sigma vipul vashisht Charts and Charting in Excel 0 September 7th 06 01:12 PM
how do I get STDEV() 2 sigma? jimbo Excel Worksheet Functions 4 January 25th 06 07:49 AM
Sigma Function? Maria Garcao Excel Worksheet Functions 6 October 15th 05 10:09 PM


All times are GMT +1. The time now is 09:00 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"