SUBTOTAL is a little strange function. There are 11 mathematical functions hiding inside it. We can calculate sum, arithmetic mean, spread, minimum/maximum and another statistic values using SUBTOTAL function. What’s more, we can limit whether we want to calculate even with hidden values which were hidden manually. All under roof of one function.

SUBTOTAL – From Mean to Dispersion

Even though this function offer a lot of possibilities, its syntax is very easy in general:

=SUBTOTAL(<type of calculation>;<range of cells>)

Thanks to the number which is the first argument of the function it is possible to select what calculation do we require. Following table shows overview of numeric codes and functions available.

without hidden values with hidden values function
102 2 COUNT
103 3 COUNT2
104 4 MAX
105 5 MIN
107 7 STDEV
108 8 STDEVP
109 9 SUM
110 10 VAR
111 11 VARP

Hidden values => hidden rows or columns

You will find a description for each function in help section of Excel or in our articles. So for example if we want to find out minimal value for area B8 to C22, we need to enter =SUBTOTAL(105,B8:C22). Take a look at the example.


It is possible to get many statistic values thanks to SUBTOTAL function without need for any other function. We only change number (code) in the argument. If you want to exclude hidden values from the area selection, enter 102 instead of 2 (for finding number of values) for example. Look at the table above. What is meant by hidden values are cells which are hidden by Hidden rows selection.

You may find our article on statistic functions useful if you want to refresh your basic statistic functions and how to manage them in Excel

Rate this post

Jan Zedníček - Data & Finance

My name is Jan Zedníček and I work as a freelancer. I have been working as a freelancer for many companies for more than 10 years.
I used to work as a financial controller, analyst and manager at many different companies in field of banking and manufacturing. When I am not at work, I like playing volleyball, chess, doing a workout in the gym and I enjoy tasting of best quality rums.
I am trying to summarize all my knowledge on this website not to forget them and to put them forward to anyone.

Leave a Reply

Your email address will not be published. Required fields are marked *