+ Reply to Thread
Results 1 to 5 of 5

Sum of variable number of rows

  1. #1
    Registered User
    Join Date
    10-19-2008
    Location
    Western Australia
    Posts
    19

    Sum of variable number of rows

    G'day All,

    I reckon this should be easier than I'm finding it, but I just can't seem to find the right combination of functions to solve this.

    In column A I will have an entry every 5 or 6 or 7 rows with blanks rows between.
    In Column B starting at every row corresponding with an entry in Column A there will be a short column of figures could be 1 2 3 or four or more of them. (the're will always be a blank between the last number in a group in B before the next entry in A)
    In column C starting at every Row corresponding to an entry in column A I want the sum of the group of figures in Column B.

    But here's the rub.... The most important thing is that I can use the same formula all the way down column C. So click the one formula at the top and drag it all the way down 1000 rows.

    I know this is easy for those with a bigger brain than mine.... but I'm stumped!
    Attached Files Attached Files
    Last edited by Aussie-Clive; 08-07-2009 at 02:37 AM.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Sum of variable number of rows

    I'm trying to stay away from ARRAY formulas, so will this work for you? It puts the total on the last row of each valid entry before the blanks. Put this in C2 and copy down:

    =IF(AND(B1<>"",B2=""),SUM($B$1:B1)-SUM($C$1:C1),"")
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    10-19-2008
    Location
    Western Australia
    Posts
    19

    Re: Sum of variable number of rows

    Thats great, that's why your rocket goes up and mine crashes & burns.

    I want to get the result on the same row as the entry in column A for easy referencing, but the solution itself is logical, elegant and simple - just what I wanted.

    Thanks very much.

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

    Re: Sum of variable number of rows

    If you wanted the value in the row in which header appears in Col A then:

    C2:
    =IF($A2<>"",SUM($B2:INDEX($B2:$B$100,MATCH(TRUE,INDEX($B2:$B$100="",0),0))),"")
    copied down

    (alter ranges to suit)

  5. #5
    Registered User
    Join Date
    10-19-2008
    Location
    Western Australia
    Posts
    19

    Re: Sum of variable number of rows

    Thanks DonkeyOte,

    That's just the job.

    Say G'day to my rellies in Sudbury and Bury.

    I'll mark this as solved and thanks again.

    Clive

+ 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