+ Reply to Thread
Results 1 to 7 of 7

Sum a range, with the range set by a cell entry.

  1. #1
    Registered User
    Join Date
    05-24-2012
    Location
    atlanta
    MS-Off Ver
    Excel 2010
    Posts
    45

    Sum a range, with the range set by a cell entry.

    Situation-I need to sum all of the prior month totals, which increment over time.

    I know the rows, and I can calculate the columns...

    For instance, It goes from D6:I37.

    But now in the next month it goes from D6:J37

    I already have a method to compute the end column based on the month whos value exists in the model. IE January would be 1+3, the 1 is available elsewhere in the sheet as a manual entry of the month to compose the report, the 3 offsets it into the array.

    The question is, what goes inside the Sum()?

    Maybe something like...
    =Sum(D6:column(Month+3)&37)

    Maybe that would work in VBA or something along those lines, but not in excel...

  2. #2
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Sum a range, with the range set by a cell entry.

    Hi baurbach,

    You can use "Dynamic Names" created using offset function...
    and then you can use this with Sum function to get the sum of desired range.

    Upload a workbook if you have any issues.. thanks.

    Regards,
    DILIPandey

    <click on below 'star' if this helps>
    DILIPandey, Excel rMVP
    +919810929744 (India), +971528225509 (Dubai), dilipandey@gmail.com

  3. #3
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Sum a range, with the range set by a cell entry.

    Maybe:

    =Sum(D6:INDEX(D37:Z37,$X$1+3))

    where X1 is the cell holding the Month number....
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  4. #4
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: Sum a range, with the range set by a cell entry.

    As the variation in your range is consistant by month you could use something like

    =SUM(D6:INDEX(D37:R37,3+Month))

    as an alternative to Dilip's suggestion.

  5. #5
    Forum Expert icestationzbra's Avatar
    Join Date
    01-07-2004
    MS-Off Ver
    2007, 2010
    Posts
    1,421

    Re: Sum a range, with the range set by a cell entry.

    you could also use OFFSET, see attached image for a similar example.
    Attached Images Attached Images
    - i.s.z -
    CSE, aka Array aka { }, formulae are confirmed with CONTROL+SHIFT+ENTER.
    Replace commas ( , ) with semicolons ( ; ) in formulae, if your locale setting demands.
    All good ideas are courtesy resources from this forum as well as others around the web.
    - e.o.m -

  6. #6
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: Sum a range, with the range set by a cell entry.

    Quote Originally Posted by icestationzbra View Post
    you could also use OFFSET
    Volatile fuctions are best avoided when possible.

  7. #7
    Registered User
    Join Date
    05-24-2012
    Location
    atlanta
    MS-Off Ver
    Excel 2010
    Posts
    45

    Re: Sum a range, with the range set by a cell entry.

    well as I dug into your suggestions and attempted to implement it into the bigger picture, the offset seemed to be the one that worked.

    What I didnt mention is that I was calling it into a sumproduct function...It works atleast.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1