← Back to all guides
Technology · 2 min READ

How to Sum Only Visible Rows in Google Sheets With SUBTOTAL

How to Sum Only Visible Rows in Google Sheets With SUBTOTAL guide illustration

Calculate a total that changes with the filter and choose whether manually hidden rows should contribute.

Quick note

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

  1. In A1:B1 put Channel and Amount. Enter Online / 30, Store / 20, and Online / 15 underneath. Put Visible total in D1.
  2. In D2 enter =SUBTOTAL(109,B2:B). With all three rows visible, expect 65. Keep summary amounts out of column B below the transactions.
  3. 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.
  4. 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?

FormulaFiltered-out rowsManually hidden rows
=SUM(B2:B)IncludedIncluded
=SUBTOTAL(9,B2:B)ExcludedIncluded
=SUBTOTAL(109,B2:B)ExcludedExcluded

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.

Google Sheets SUBTOTAL reference

SHARE THIS GUIDE

Know someone who could use this?

DISCUSSION

Comments

Comments are reviewed before they become public.

No approved comments yet. Be the first to start the discussion.