Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default Sum Formula with variable range

I need to calculate the moving average in column C for a long list of numbers
in Colum B. If the variable is in cell A1 and it = 3, then each sum formula
should sum a range of the rows, such as; Sum($B$1:$B3),
A1 is changed to 5, then Sum($B$1:$B5), where the variable in cell A1 is the
row number of end of the range.
How can this be accomplished?


  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,939
Default Sum Formula with variable range

One way...

=SUM(OFFSET($B$1,0,0,A1,1))

You could also use indirect but then you would not be able to drag your
formula if you needed to.
--
HTH...

Jim Thomlinson


"Migo1" wrote:

I need to calculate the moving average in column C for a long list of numbers
in Colum B. If the variable is in cell A1 and it = 3, then each sum formula
should sum a range of the rows, such as; Sum($B$1:$B3),
A1 is changed to 5, then Sum($B$1:$B5), where the variable in cell A1 is the
row number of end of the range.
How can this be accomplished?


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 15,768
Default Sum Formula with variable range

Try this...

Assume you enter the 1st formula in D1.

A1 = 3

=AVERAGE(OFFSET(B$1,ROWS(D$1:D1)*A$1-A$1,,A$1))

Copy down as needed.

D1 = average of B1:B3
D2 = average of B4:B6
D3 = average of B7:B9
etc
etc

If A1 is an empty cell you'll get an error.

--
Biff
Microsoft Excel MVP


"Migo1" wrote in message
...
I need to calculate the moving average in column C for a long list of
numbers
in Colum B. If the variable is in cell A1 and it = 3, then each sum
formula
should sum a range of the rows, such as; Sum($B$1:$B3),
A1 is changed to 5, then Sum($B$1:$B5), where the variable in cell A1 is
the
row number of end of the range.
How can this be accomplished?




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
Formula based on variable range BruceM via OfficeKB.com Excel Worksheet Functions 3 November 17th 09 07:45 PM
Variable Range for NPV Dkline Excel Worksheet Functions 7 August 27th 08 02:14 PM
how to specify a range that is variable. Mal[_2_] Excel Worksheet Functions 4 April 9th 08 03:39 PM
Excel Named Formula Weakly Interacts with a Variable Range on the Worksheet - Re-Visit [email protected] Excel Discussion (Misc queries) 5 September 6th 07 06:42 PM
Variable Determines Number of Cell in Formula Range MJSlattery Excel Worksheet Functions 0 March 30th 06 01:28 AM


All times are GMT +1. The time now is 07:48 AM.

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"