How to Sum Filtered Rows in Google Sheets
To sum filtered rows in Google Sheets, you can use the SUBTOTAL function. The SUBTOTAL function allows you to perform calculations on visible cells only, ignoring any hidden or filtered cells.
Here's how to use the SUBTOTAL function to sum filtered rows:
- Click on an empty cell where you want to display the sum of the filtered rows.
- Type the following formula:
=SUBTOTAL(9, range)
, whererange
is the range of cells you want to sum. For example, if you want to sum values in column A from row 2 to row 100, you would use the formula=SUBTOTAL(9, A2:A100)
. - Press Enter.
Now, the cell will display the sum of the visible rows in the specified range, ignoring any hidden or filtered rows.
Example
Let's say you have a dataset in columns A and B, where column A contains the sales values, and column B contains the region for each sale. You want to sum the sales values only for the visible rows after applying a filter to column B.
- Select the entire data range, including headers, in this case, A1:B10.
- Click the "Data" tab in the menu.
- Click "Create a filter" to apply a filter to the selected range.
- Click the filter icon in the header of column B, and select the regions you want to display, then click "OK" to apply the filter.
- Click on an empty cell, for example, C1, to display the sum of the filtered sales values.
- Type the formula
=SUBTOTAL(9, A2:A10)
and press Enter.
Now, cell C1 will show the sum of the visible sales values in column A, ignoring any hidden or filtered rows.
Did you find this useful?