• Sum first number “n” values

    Author
    Topic
    #467269

    Hi,

    I’m trying to figure out the formula to sum the first “n” values in a table. The “n” value is the number of rows that will be equal to the value in cell C1 minus 1 row (see attached spreadsheet). I think you need to use the index function here to figure out the “n” value, but I have no idea how.

    Thanks.

    Viewing 2 reply threads
    Author
    Replies
    • #1212702

      Do really mean sum all the values in C IF the value in A is < the value in C1 ?

      That appears to be what the calculation you have in there is attempting to do.

      If that is the case then

      =SUMIF($A$6:$A$37,"<" & $C$1,$C$6:$C$37)

    • #1212703

      I’m not clear on your question – does =SUMIF($A$6:$A$37,”<"&C1,$C$6:$C$37) do what you want?

      • #1212737

        Great, this is what I wanted. I can’t believe the equation is this simple. I’m so glad that this forum exists. Thanks all!

        Just for interest sake, I was sure that the same could have been achieved using the ‘INDEX’ and ‘MATCH’ functions to get the “to” cell address so that the summation equation would have been ‘=sum(A6:A#)’, where”#” corresponds to a row number of a value not greater than the value in C1. Anyone knows the full function for this?

    • #1212770

      Something like this perhaps?
      Steve

      =SUM(OFFSET(C5,0,0,MATCH(C1,A6:A37),1))

    Viewing 2 reply threads
    Reply To: Sum first number “n” values

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: