+ Reply to Thread
Results 1 to 7 of 7

Return value once sum is greater than a certain number

  1. #1
    Forum Contributor
    Join Date
    12-22-2006
    Posts
    114

    Cool Return value once sum is greater than a certain number

    I have a row of numbers from 1-20 in row A
    Row B contains random numbers i.e. 0.1, 0.3, 0.2, 0.4

    I need a formula that can effectively go along row b adding up the values until it is above the value "1" and then return the value in row A.

    I have a feeling it has to be some kind of h lookup with a sumif?

    Any help would be much appreciated.

    Thanks in advance

  2. #2
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Return value once sum is greater than a certain number

    A and B are columns, nor rows....

    Assuming data in columns try this "array formula"

    =INDEX(A1:A20,MATCH(1,SUBTOTAL(9,OFFSET(B1,,,ROW(B1:B20)-ROW(B1)+1)))+1)

    confirmed with CTRL+SHIFT+ENTER
    Audere est facere

  3. #3
    Forum Contributor
    Join Date
    12-22-2006
    Posts
    114

    Re: Return value once sum is greater than a certain number

    Sorry, had a senior moment! The data is in rows not columns, can i repeat that formula with "column" rather than "row"?

  4. #4
    Forum Contributor
    Join Date
    12-22-2006
    Posts
    114

    Re: Return value once sum is greater than a certain number

    And ideally at the end of the row it just returns the lookup value. I have attached a demo
    Attached Files Attached Files

  5. #5
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Return value once sum is greater than a certain number

    SUBTOTAL function only works for columns so a slightly different approach.....

    Try this formula in N2

    =INDEX(A$1:L$1,MATCH(TRUE,SUMIF(OFFSET(A2,,,,COLUMN(A2:L2)-COLUMN(A2)+1),"<9.99E+307")>=1,0))

    confirmed with CTRL+SHIFT+ENTER

    If the values in row 1 will always start at 1 (and increase by 1 each time) then you can do without the INDEX part, i.e. just

    =MATCH(TRUE,SUMIF(OFFSET(A2,,,,COLUMN(A2:L2)-COLUMN(A2)+1),"<9.99E+307")>=1,0)

    Note: as F3 is 0.5 not 0.05 N3 value will be 6 not 7......
    Last edited by daddylonglegs; 06-30-2011 at 03:09 PM.

  6. #6
    Forum Contributor
    Join Date
    12-22-2006
    Posts
    114

    Re: Return value once sum is greater than a certain number

    That is absolutely brilliant!! The actual data in row 1 is not increasing by 1 each time. So the first one works perfectly!

    Thank you so much!! Such a life saver!!

  7. #7
    Forum Contributor
    Join Date
    12-22-2006
    Posts
    114

    Re: Return value once sum is greater than a certain number

    So sorry, one last thing to complete this..... how would you write the formula in reverse? i.e. I was to put "5" into a cell and then it would return the sum of everything in that row up to that point?

+ 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