Google Sheets – Sum Until Empty Line Function

google sheets

I'm using this data layout a lot:

   A      B     C
 1 Name1  Count Total
 2 A      1     =SUM(B2:B4)
 3 B      2
 4 C      1
 5
 6 Name2  Count Total
 7 D      1     =SUM(B7:B8)
 8 E      2

It is useful to present data to viewer, but it is ugly to maintain. If you have to add an entry to a given category, you have to edit corresponding SUM manually.

I'd like to be able to write something like =SUM_UNTIL_BLANK(B2).

Is it possible with Google Spreadsheets?

Best Answer

Set the summation to cell C5. If you insert a row above or below, then all formula's will be adjusted accordingly. You can add this to the cell as well:

IF(SUM(B2:B4)="";"";SUM(B2:B4))