Web Applications Stack Exchange is a question and answer site for power users of web applications. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is it possible to sum a range of cells while ignoring rows which are not hidden?


share|improve this question
Unfortunately, this is not possible via formula's or Google Apps Script. See this Q&A on Stack Overflow: stackoverflow.com/q/6793805/1536038. Please follow the feature request and star it !! – Jacob Jan Tuinstra Jun 19 '13 at 11:24
Thanks for pointing that out :) – Sam Jun 19 '13 at 15:45

I'm not sure if you necessarily require a Google Apps Script solution; the tags you have used suggest that a spreadsheet formula might be adequate. If this is the case, then it is definitely possible to sum only rows that are not hidden with SUBTOTAL.

For example:


will sum all cells in column A that are not hidden.

Where 109 is function_code which consist 9 for SUM with prepended 10 so hidden values can be skipped.

share|improve this answer
Where can the reference be found regarding the function_code argument? I've learned something today !! Thanks for that. – Jacob Jan Tuinstra Jun 20 '13 at 5:55
Unfortunately the Google Docs documentation leaves something to be desired (the links within that blog post used to work). In this case I think it would be reasonably safe to rely on the Excel documentation: office.microsoft.com/en-au/excel-help/… – AdamL Jun 20 '13 at 6:15
Documentation for SUBTOTAL (including function_code) can be found at Google Docs Help Center. – kenorb Aug 4 '15 at 22:23

Turns out its not possible (for now).

Feature request: https://code.google.com/p/google-apps-script-issues/issues/detail?id=195

share|improve this answer
It is according to SUBTOTAL docs. – kenorb Aug 4 '15 at 22:22

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.