Use subtotal
subtotal(2;A#:A#)
Syntax:
Subtotal(function; range)
range is which cells are selected by filtering for calculation.
function is a number that specifies the function to calculate, as follows:
function Function
1 AVERAGE
2 COUNT
3 COUNTA
4 MAX
5 MIN
6 PRODUCT
7 STDEV
8 STDEVP
9 SUM
10 VAR
11 VARP
Se precisar de ajuda com a função, consulte esta documentação