Search code examples
excelexcel-formulamatchformula

Excel formula for summing all values situated right under each match of a string in a column


Here is my data:

I'm looking for an Excel formula that would calculate the sum of all values in a column, values situated right under every match of a string in that column.
So formula in B1 should return 17 (1+6+10).
It would be great to also pass to the formula the desired row offset of summed values, if possible (this would be 1 in my example).


Solution

  • Faster, but without explicit offset:

    =SUMIF(A1:A17,"A",A2:A18)
    

    Slower, but with explicit offset:

    =SUMIF(A1:A17,"A",OFFSET(A1:A17,1,0))