How to Subtotal Up to the First Blank Cell in a Column in Google Sheets

Hey there, my savvy spreadsheet enthusiasts! Are you tired of trying out different formula options in Google Sheets just to subtotal up to the first blank cell in a column? Well, worry no more! I’ve got you covered with this nifty tutorial that will solve your subtotaling woes.

The Difference between Summing and Subtotaling

Before we dive into the solution, let’s quickly clarify the difference between summing and subtotaling in Google Sheets. When you want to sum up a column, you’re basically adding up all the values in that column. However, when you want to subtotal up to the first blank cell, you need to take into account any hidden rows resulting from filtering, grouping, or hiding them manually.

Thankfully, Google Sheets has got your back with the SUBTOTAL() function, which is the only function that can sum only the visible rows. Not only can you use it to total a column while excluding those filtered out, hidden, or collapsed rows, but you can also apply various aggregation functions using function_codes.

Now, let’s jump right into the tutorial!

How to Sum up to the First Blank Cell in Google Sheets

Let’s start with a simple example. Suppose you want to sum the range C2:C5, but only until you reach the first blank cell, which in this case is C6. To achieve that, you can use the following formula:

=ArrayFormula(SUM(INDIRECT("C2:C"&MIN(IF((C2:C)="",ROW(C2:C)-1)))))

This formula will return the sum of the range C2:C5, which is 5 in this case. Easy peasy, right? You can apply the same method to any other range as well.

How to Subtotal Up to the First Blank Cell in a Column

Now, let’s take it up a notch and learn how to subtotal up to the first blank cell in a column. This technique will come in handy when you have hidden or grouped rows that you want to include in your subtotal.

Here’s what you need to do:

  1. Select the rows you want to subtotal, then right-click and group them. For example, select rows 2 to 5 and group them, and do the same for rows 8 to 14.

  2. Replace the formula in cell C1 with this modified one:

=ArrayFormula(SUBTOTAL(109,INDIRECT("C2:C"&MIN(IF((C2:C)="",ROW(C2:C)-1))))))
  1. Likewise, replace the formula in cell C7 with the following:
=ArrayFormula(SUBTOTAL(109,INDIRECT("C8:C"&MIN(IF((C8:C)="",ROW(C8:C)-1))))))

By using the SUBTOTAL function with function_code 109, you can subtotal the visible rows up until you reach the first blank cell. How cool is that?

Benefit from the Magic of Subtotaling

Now, let’s talk about the benefits of subtotaling up to the first blank cell in a column. By collapsing the row grouping, you can easily see that the total becomes 0 within that group. But fear not! Expand the group again, and you’ll witness the sum of the visible rows magically reappear. This is all thanks to the power of the SUBTOTAL function, which works its wonders even with filtered or hidden rows.

So there you have it, my dear spreadsheet aficionados! I hope this detailed tutorial on how to subtotal up to the first blank cell in Google Sheets has proven to be enlightening and helpful for your data manipulation needs. If you enjoyed this article, feel free to share it with your fellow spreadsheet enthusiasts. And remember, for more Google Sheets tips and tricks, visit Crawlan.com. Stay fabulous and keep on spreadsheet-ing!

Related posts