+ Reply to Thread
Results 1 to 5 of 5

Formula to add the above number (cell) until it finds "0"

  1. #1
    Registered User
    Join Date
    09-08-2011
    Location
    West Midlands
    MS-Off Ver
    Excel 2003
    Posts
    5

    Formula to add the above number (cell) until it finds "0"

    Hello all,

    I'm try to do the below to make some very time consuming work a case of copying and pasting a formula but I don't even know if it's possible. Any help would be very much appreciated.

    Basically I've got a column of numbers ranging from 0 to 10,000 and I want the cell next to the number to = the sum of all numbers above it until it hits a 0. Obviously I can do this manually but is there any formula that can do this so I can just copy & paste (drag) the formula down column C?

    So for example (please see the attached)

    Cell C5 would = A2 + A3 +A4 +A5 (but no cells above A1)
    Cell C7 would = A6 +A7 (but no cells above A5)
    Cell C10 would = A6 + A7 + A8 + A9 + A10 (but no cells above A5)
    Cell C17 would = A16 + A17 (but no cells above A15)

    What do you think? Is it possible?

    Any help would be very much appreciated.

    Dave
    Attached Files Attached Files

  2. #2
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,448

    Re: Formula to add the above number (cell) until it finds "0"

    Perhaps enter the following in B2
    Please Login or Register  to view this content.
    and pull down as needed

  3. #3
    Registered User
    Join Date
    09-08-2011
    Location
    West Midlands
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: Formula to add the above number (cell) until it finds "0"

    Hi,

    Thanks for your reply!

    OK, I've tried this on my example and it works like a charm however when I try to implement it in my actual project I can't get it to work, I've edited the cell references to correspond with my file (A1 is now V6 and B1 is now W6) so I edited as follows....

    =SUM($V$6:V7)-SUM($V$6:INDEX($V$6:$V$100,SUMPRODUCT(MAX(ROW($6:7)*($V$6:V7=0)))))

    However it produces some very different outcomes to those expected. I've attached a portion (- some sensitive data) of the actual file.

    What is it that I'm missing?

    Thank you ever so much for your help with this it really is very much appreciated..
    Last edited by dave7352; 10-09-2013 at 04:16 PM.

  4. #4
    Registered User
    Join Date
    09-08-2011
    Location
    West Midlands
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: Formula to add the above number (cell) until it finds "0"

    The attachment I forgot to attach
    Attached Files Attached Files

  5. #5
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,448

    Re: Formula to add the above number (cell) until it finds "0"

    1.In column V you used =IF(G6="d","0",R6). The TRUE argument is text, while the formula needs a number. So, replace "0" with a plain 0
    Please Login or Register  to view this content.
    and pull down
    2. You were on the right track with the formula except for the ROW() part. It should be row($1:2), because it is the "place" number in the range V6:V100 ( nothing to do with the row number of the sheet)

    Please Login or Register  to view this content.
    should do the trick provided you change your formula in col V

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Macro or Eqn to Repeat Formula "X" times based on Number in Cell
    By waltheaj in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-16-2013, 12:24 PM
  2. [SOLVED] Need a "LASTVALUEABOVE()" function, i.e., something that finds the last cell w/ a value
    By theorist in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-30-2012, 04:35 PM
  3. [SOLVED] How to Count number of "Error" and "OK" after the word "Instrument" found in table row
    By eltonlaw in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-17-2012, 06:26 AM
  4. Replies: 9
    Last Post: 11-14-2005, 05:20 PM
  5. Replies: 3
    Last Post: 11-13-2005, 09:55 PM

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