subtotal
Aggregate over visible cells using a function code.
Syntax
Section titled “Syntax”v = subtotal(fn, ref1, ref2, ...)Description
Section titled “Description”Returns an aggregate (mean, sum, max, etc.) over the cells in ref1, ref2, ..., choosing the operation by integer code fn:
1/101— average2/102— count (numbers)3/103— counta4/104— max5/105— min6/106— product7/107— stdev_s8/108— stdev_p9/109— sum10/110— var_s11/111— var_p
Codes ≥100 ignore manually hidden rows.
Example
Section titled “Example”subtotal(9, A1:A20) % sum, equivalent to sum(A1:A20)