Results 1 to 6 of 6
  1. #1
    2 Star Lounger
    Join Date
    Oct 2008
    Posts
    141
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.
    Attached Files Attached Files

  2. #2
    5 Star Lounger AndrewKKWalker's Avatar
    Join Date
    Apr 2001
    Location
    Cambridge, UK
    Posts
    1,020
    Thanks
    0
    Thanked 3 Times in 3 Posts
    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)

    [attachment=88297:Sum_to_Value.xls]

    Attached Files Attached Files
    Andrew

  3. #3
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,508
    Thanks
    0
    Thanked 6 Times in 6 Posts
    I'm not clear on your question - does =SUMIF($A$6:$A$37,"<"&C1,$C$6:$C$37) do what you want?
    -John ... I float in liquid gardens
    UTC -7ąDS

  4. #4
    2 Star Lounger
    Join Date
    Oct 2008
    Posts
    141
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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?

  5. #5
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts
    Something like this perhaps?
    Steve

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

  6. #6
    2 Star Lounger
    Join Date
    Oct 2008
    Posts
    141
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Works great. Thanks.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •