How to Sum Only Visible Rows in Google Sheets With SUBTOTAL

Calculate a total that changes with the filter and choose whether manually hidden rows should contribute.
Follow these steps at your own pace. Check product terms and prices directly with providers before purchasing.
Quick answer
Use SUBTOTAL with function code 109 for a sum that excludes both filtered-out rows and manually hidden rows. Place the formula outside its source range so the total cannot include itself.
Make the total respond to a filter
- In A1:B1 put Channel and Amount. Enter Online / 30, Store / 20, and Online / 15 underneath. Put Visible total in D1.
- In D2 enter
=SUBTOTAL(109,B2:B). With all three rows visible, expect 65. Keep summary amounts out of column B below the transactions. - Select A1:B4 and choose Data → Create a filter. Open the Channel filter and show Online only. D2 should now show 45. Clear the filter to return to 65.
- To test manual hiding, hide the row containing 20. Code 109 should return 45 again. Unhide the row when your test is complete.
Which formula fits your report?
| Formula | Filtered-out rows | Manually hidden rows |
|---|---|---|
=SUM(B2:B) | Included | Included |
=SUBTOTAL(9,B2:B) | Excluded | Included |
=SUBTOTAL(109,B2:B) | Excluded | Excluded |
If the result is too low, compare the filtered records with the highlighted amount cells. Imported text can look like a price and still contribute nothing to a sum. A typed subtotal inside the data can also inflate the answer. Keep one amount per transaction.
In a shared file, use a personal filter view when you only need to change your own view. For a published category breakdown that stays visible for everyone, build a sales pivot table.
Comments
Comments are reviewed before they become public.
Sign in with Google to leave a comment.
Sign in with GoogleNo approved comments yet. Be the first to start the discussion.