Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 989
Default Summing a rolling range of cells

How do I sum the adjacent 4 columns into a cell? I want an cell to always sum
the 4 cells to the left, allowing for me inserting a new column each week,
ie. a rolling answer.

Any help greatly appreciated.

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10
Default Summing a rolling range of cells

Use a mixed reference in your SUM function: =SUM($C2:F2), if columns C to F
are your 4 columns, always insert a new row before the last data column
(i.e., your 3rd column with 4 columns of data, the 4th column with 5 columns
of data etc.) and then you AutoFill the formula down to the remaining rows in
the last column...I am assuming you are summing.

The alternative is VBA where you make Excel look for a new column to the
left of the SUM column and then programatically change the range argument of
the SUM function in the 5th, 6th etc. column where you are summing.
--
Gnothi se auton.


"Mark" wrote:

How do I sum the adjacent 4 columns into a cell? I want an cell to always sum
the 4 cells to the left, allowing for me inserting a new column each week,
ie. a rolling answer.

Any help greatly appreciated.

Thanks

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Summing a rolling range of cells

If the cell that contains the formula is E1, then one way:
=SUM(OFFSET(E1,0,-4,1,4))



Mark wrote:

How do I sum the adjacent 4 columns into a cell? I want an cell to always sum
the 4 cells to the left, allowing for me inserting a new column each week,
ie. a rolling answer.

Any help greatly appreciated.

Thanks


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10
Default Summing a rolling range of cells

Offset assumes you know how many columns there are going to be. You will have
to change it every time you insert a column which at that point, you may as
well reselect the SUM function range as it will be faster to do.
--
Gnothi se auton.


"Dave Peterson" wrote:

If the cell that contains the formula is E1, then one way:
=SUM(OFFSET(E1,0,-4,1,4))



Mark wrote:

How do I sum the adjacent 4 columns into a cell? I want an cell to always sum
the 4 cells to the left, allowing for me inserting a new column each week,
ie. a rolling answer.

Any help greatly appreciated.

Thanks


--

Dave Peterson

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default Summing a rolling range of cells

Consider this UDF:

Function zum() As Variant
Application.Volatile
With Application.Caller
zum = .Offset(0, -4) + .Offset(0, -3) + .Offset(0, -2) + .Offset(0, -1)
End With
End Function

It will always sum the four cells to the immediate left of the cell
containing the function.
--
Gary''s Student - gsnu200758


"Mark" wrote:

How do I sum the adjacent 4 columns into a cell? I want an cell to always sum
the 4 cells to the left, allowing for me inserting a new column each week,
ie. a rolling answer.

Any help greatly appreciated.

Thanks



  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Summing a rolling range of cells

The OP said that he wanted to always sum 4 columns to the left.

I don't understand your comment.

xrelanon wrote:

Offset assumes you know how many columns there are going to be. You will have
to change it every time you insert a column which at that point, you may as
well reselect the SUM function range as it will be faster to do.
--
Gnothi se auton.

"Dave Peterson" wrote:

If the cell that contains the formula is E1, then one way:
=SUM(OFFSET(E1,0,-4,1,4))



Mark wrote:

How do I sum the adjacent 4 columns into a cell? I want an cell to always sum
the 4 cells to the left, allowing for me inserting a new column each week,
ie. a rolling answer.

Any help greatly appreciated.

Thanks


--

Dave Peterson


--

Dave Peterson
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
Summing periodic sales on a rolling basis JohnnStar Excel Worksheet Functions 2 July 21st 06 01:17 PM
Summing cells in a range that has #VALUE! cs_vision Excel Discussion (Misc queries) 5 July 17th 06 11:12 PM
How to Calculate a sum between a rolling data range. Charles Johnston Excel Discussion (Misc queries) 3 June 1st 05 08:29 PM
Z Chart i.e. top rolling annual bottom rolling monthly middle cum. wat prin Excel Worksheet Functions 0 January 28th 05 03:43 PM
summing part of cells in a range excelFan Excel Discussion (Misc queries) 2 December 5th 04 12:33 PM


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