Get a subtotal in a list or database
=SUBTOTAL(function_num, ref1, [ref2], ...)
| Parameter | Description |
|---|---|
function_num |
A number that specifies which function to use in calculating subtotals within a list. See table below for full list. |
ref1 |
A named range or reference to subtotal. |
ref2 |
[optional] A named range or reference to subtotal. |
Below are examples of SUBTOTAL configured to SUM, COUNT, and AVERAGE the values in a range. Notice the only difference is the value used for the funct
=SUBTOTAL(109,range) // SUM
=SUBTOTAL(103,range) // COUNT
=SUBTOTAL(101,range) // AVERAGE
In the worksheet shown above, the formulas in C4 and F4 are:
=SUBTOTAL(3,B7:B19) // count visible
=SUBTOTAL(9,F7:F19) // sum visible