How to use the Subtotal Function with Filters in Excel

Posted on:  10/24/2021
How to use the Subtotal Function with Filters in Excel

We love to use Filters in Excel. When filtering data, the filtered rows turn blue. To get the SUM, AVERAGE, MAX, MIN, or COUNT of the filtered data, use the SUBTOTAL function.

Subtotal Function in Excel

Subtotal Function in Excel

If you use one of the functions with one argument - SUM, AVERAGE, MAX, MIN, or COUNT - you'll end up with the incorrect answer. For example, when filtering data and you want the highest value, the MAX function is incorrect. You want to use =SUBTOTAL(4,cell range). You don't want the highest value if it is hidden. This is why you use the SUBTOTAL function.

YouTube video of the SUBTOTAL function

Other Excel articles

SUBTOTAL function groups

The SUBTOTAL function has two groups. Group 1 is 1 through 11, and Group 2 is 101 to 111. The SUBTOTAL function can return hidden or ignore hidden values, but it doesn't matter which group you use when used with Filters. The first group, 1 to 11, will include hidden, and 101 to 111 will ignore hidden. But as mentioned, with filtered data, it doesn't matter which group is used.

Syntax of the SUBTOTAL function

 

=SUBTOTAL(function_num,ref1,[ref2],...)

 

Arguments for the SUBTOTAL function

Function Include hidden Ingnore hidden
Average 1 101
Count 2 102
Counta 3 103
Max 4 104
Min 5 105
Product 6 106
StDev 7 107
StDevP 8 108
SUM 9 109
Var 10 110
Varp 11 111

 

Other Excel articles

Chris Menard

Chris Menard is a certified Microsoft Trainer (MCT) and works as a full-time Trainer at BakerHostetler - one of the largest law firms in the US. He runs a YouTube channel with 900+ technology videos that cover various tools such as Excel, Word, Zoom, Teams, Gmail, Google Calendar, and Outlook. To date, the channel has helped over 20 million viewers. Menard also does 2 to 3 public speaking events every year, presenting at the Administrative Professional Conference (APC), the EA Ignite Conference, the Support Staff Conference, the University of Georgia, and CPA conferences. You can connect with him on LinkedIn at https://chrismenardtraining.com/linkedin or watch his videos on YouTube at https://chrismenardtraining.com/youtube.

Categories