+ Reply to Thread
Results 1 to 4 of 4

Variable Sums

  1. #1
    Registered User
    Join Date
    07-16-2009
    Location
    Seattle, WA
    MS-Off Ver
    Excel 2003
    Posts
    2

    Variable Sums

    Hello. First time on this forum, and I'm a fairly new excel user. Not bad, but not great.

    My question:

    I have an array, A1:C5. I want to sum up rows in the C column that depend on specific criteria USING columns A and B, and put them in Column D.

    For example:
    ---A B C D
    1 1 2 10 Results
    2 2 3 12
    3 3 1 9
    4 4 2 10
    5 5 2 6

    For Row A Result, I want C1+C2, based on the fact that B1 is 2 (summing two rows in Column C starting with C1).

    For Row B Result, I want C2+C3+C4 based on the fact that B2 is 3 (summing three rows in Column C starting with C2).

    For Row C Result, I want C3 based on the fact that B3 is 1 (summing one row in Column C starting with C3).

    For Row D Result, I want C4+C5 based on the fact that B4 is 2 (summing two rows in Column C starting with C4).

    etc, etc...


    Thanks for any help. I've been searching the internet all night and can't figure it out, seems like I've played with every function in the book. I can provide more detailed info if needed.

    Thanks again!

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Variable Sums

    You can use:

    D1: =SUM(OFFSET(C1,,,B1,1))
    copied down

    Note: OFFSET is Volatile (see link in sig. for more info).

  3. #3
    Valued Forum Contributor squiggler47's Avatar
    Join Date
    02-17-2009
    Location
    Littleborough, UK
    MS-Off Ver
    Excel 3.0 to 2007+2010! (couldnt get 2.1 working)
    Posts
    1,013

    Re: Variable Sums

    you could do

    =SUM(INDIRECT("c"&A1&":"&"c"&(A1+A2-1)))

    copied down in row D
    Regards
    Darren

    Update 12-Nov-2010 Still job hunting!

    If you are happy with the results, please add to our reputation by clicking the blue scales icon in the blue bar of the post.

    Learn something new each day, Embrace change do not fear it, evolve and do not become extinct!


  4. #4
    Registered User
    Join Date
    07-16-2009
    Location
    Seattle, WA
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: Variable Sums

    DonkeyOte,

    That worked perfectly! I can't believe I wasted so much time. I tried the OFFSET function earlier, but the Volatile result threw me off. Thanks for the help! Squiggler, thanks for the reply too, I'm sure your way would have worked, I just didn't try it.

    Thanks again!
    SeattleDuck

+ 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