• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Sum a column of data with flexible end point

mr_hiboy

Member
Hi, hope you can help, you normally do!


I'd like to be able sun a column of data, e.g. A1:A52 but have the ability to change the reference A52 based on another formula/cell.


It refers to 52 weeks of the year, I'd like to be able to change the week starting in another cell so the sum only sums a number of weeks e.g. A1:A26.


Thanks
 
Hi ,


The standard way to do this is to use the SUM(OFFSET(...)) construct ; suppose your range is from A1 to some dynamic end cell in column A , and suppose the number of weeks is in cell B1 , then the following formula will do the job :


=SUM(OFFSET($A$1,,,B1))


If you want the starting cell also to be dynamic , then use this as an offset e.g. if the starting week is to be entered in C1 , then you can have :


=SUM(OFFSET($A$1,C1-1,,B1))


Narayan
 
Hats of to you Narayan, works a treat.


U'll swot up on offset as it's been the answer to a few of my questions in the past!


Thanks again
 
Back
Top