Manage worksheet data

Summarizing Filtered Data

Analyzing the most vital data is important, but there are limitations to summarizing filtered data using functions like SUM and AVERAGE. One limitation is that these functions don't adjust their calculations if some rows are hidden by a filter.

Excel offers two ways to summarize only the visible cells in a filtered list. The first method is AutoCalculate. To use AutoCalculate, select the cells you want to summarize. Excel displays the average, sum, and count of the visible cells in the selection on the status bar at the lower edge of the window.

AutoCalculate isn't limited to sum, average, and count. You can add or remove calculations as needed; a check mark appears next to a function's name if its result is shown on the status bar.

The status bar displays summary values when you select more than one cell that contains numeric data
The status bar displays summary values when you select more than one cell that contains numeric data

However, AutoCalculate doesn't make the result available in the worksheet. Formulas like =SUM(C1:C9) always consider every cell in the range, regardless of hidden rows. To summarize only visible values, use the SUBTOTAL or AGGREGATE function.

The SUBTOTAL function allows you to choose whether to summarize all values in a range or only those in visible rows. Its syntax is =SUBTOTAL(function_num, ref1, ref2, ...). The function_num argument specifies the operation to summarize your data. The ref1, ref2, etc., arguments represent up to 29 ranges to include in the calculation.

For example, if you manually hide rows 10-16, the formula =SUBTOTAL(9, C3:C16, E3:126, G3:G16) sums all values in the ranges, including hidden rows. The formula =SUBTOTAL(109, C3:C16, E3:E16, G3:G16) sums only the visible values, ignoring manually hidden rows.

Place your SUBTOTAL formula in a row even with or above the headers in the filtered range to avoid hiding the formula's result.

The following table lists the summary operations available for the SUBTOTAL formula. Excel displays the available summary operations as part of the Formula AutoComplete functionality, so you don’t need to remember the operation make_numbers_easy_to_read.mdx

Operation number (includes hidden values)
Description (ignores values in manually hidden rows)
Function
Description
1
101
AVERAGE
Return the average of the values in the range
2
102
COUNT
Counts the cells in the range that contain a number
3
103
COUNTA
Counts the nonblank cells in the range
4
104
MAX
Return the largest (maximum) value in the range
5
105
MIN
Return the smallest (minimum) value in the range
6
106
PRODUCT
Returns the result of multiplying all numbers in the range
7
107
STDEV.S
Calculate the standard deviation of values in the range by examining a sample of the values
8
108
STDEV.P
Calculate the standard deviation of values in the range by using all values
9
109
SUM
Returns the result of adding all numbers in the range together
10
110
VAR.S
Calculate the variance of values in the range by examining a sample of the values
11
111
VAR.P
Calculate the variance of values in the range by using all the values

As the preceding table shows, the SUBTOTAL function has two sets of operations. The first set (operations 1–11) includes hidden values in their summary, while the second set (operations 101–111) summarizes only visible values. Operations 1–11 summarize all cells in a range, regardless of hidden rows. In contrast, operations 101–111 ignore values in manually hidden rows. However, the SUBTOTAL function does not adjust its result for rows hidden by a filter.

Excel treats the first cell in the data range as a header cell, so it doesn’t consider it when building the list of unique values. Be sure to include the header cell in your data range!

The AGGREGATE function extends the capabilities of the SUBTOTAL function. It allows you to select from a broader range of functions and use another argument to determine which values to ignore in the calculation. The AGGREGATE function has two possible syntaxes, depending on the summary operation you select. The first syntax is =AGGREGATE(function_num, options, ref1…), similar to the SUBTOTAL function. The second syntax, =AGGREGATE(function_num, options, array, [k]), is used for LARGE, SMALL, PERCENTILE.INC, QUARTILE.INC, PERCENTILE.EXC, and QUARTILE.EXC operations.

The following table summarizes the summary operations available for use in the AGGREGATE function.

Number
Function
Description
1
AVERAGE
Returns the average of the values in the range
2
COUNT
Counts the cells in the range that contain a number
3
COUNTA
Counts the nonblank cells in the range
4
MAX
Return the largest (maximum) value in the range
5
MIN
Return the smallest (minimum) value in the range
6
PRODUCT
Return the result of multiplying all numbers in the range
7
STDEV.S
Calculates the standard deviation of values in the range by examining a sample of the values
8
STDEV.P
Calculates the standard deviation of values in the range by using all the values
9
SUM
Return the result of adding all numbers in the range together
10
VAR.S
Calculate the variance of values in the range by examining a sample of the values
10
VAR.S
Calculate the variance of values in the range by examining a sample of the values
11
VAR.P
Calculate the variance of values in the range by using all the values
12
MEDIAN
Returns the values in the middle of the group of values
13
MODE.SNGL
Returns the most frequently occurring number from a group of numbers
14
LARGE
Return the k-th largest value in a data set; k is specified by using the last function argument. If k is left blank, Excel return the largest value.
15
SMALL
Return the k-th smallest value in a data set; k is specified by using the last function argument. If k is left blank, Excel return the smallest value.
16
PERCENTILE.INC
Return the k-th percentile of values in a range, where k is a value from 0 to 1, inclusive.
17
QUARTILE.INC
Return the quartile value of data set, based on a percentage from 0 to 1, inclusive.
18
PERCENTILE.EXC
Return the k-th percentile of values in a range, where k is a value from 0 to 1, exclusive
19
QUARTILE.EXC
Return the quartile value of data set, based on a percentage from 0 to 1, exclusive.

You use the second argument, options, to select which items the AGGREGATE function should ignore. These items can include hidden rows, errors, and SUBTOTAL and AGGREGATE functions. The following table summarizes the values available for the options argument and the effect they have on the function’s results.

Number
Description
0
Ignore nested SUBTOTAL and AGGREGATE functions
1
Ignore hidden rows and nested SUBTOTAL and AGGREGATE functions
2
Ignore error values and nested SUBTOTAL and AGGREGATE functions
3
Ignore hidden rows, error values, and nested SUBTOTAL and AGGREGATE functions
4
Ignore nothing
4
Ignore hidden rows
4
Ignore error values
4
Ignore hidden rows and error values

Summarize values by using AutoCalculate

  • Select the cells in your worksheet.
  • View the summaries on the status bar.

Change the AutoCalculate summaries displayed on the status bar

  • Click on Customize Status Bar
Change the Status Bar
Change the Status Bar
  • Click a summary operation without a check mark to display it.

Create a SUBTOTAL formula

In a cell, enter a formula that uses the syntax =SUBTOTAL(function_num, ref1, ref2, …). The arguments in the syntax are as follows:

  • The function_num argument is the reference number of the function you want to use.
  • The ref1, ref2, and subsequent ref arguments refer to cell ranges.

Create an AGGREGATE formula

Create a formula of the syntax =AGGREGATE(function_num, options, ref1…). The arguments in the syntax are as follows:

  • The function_num argument is the reference number of the function you want to use.
  • The options argument is the reference number for the options you want.
  • The ref1, ref2, and subsequent ref arguments refer to cell ranges.

or

Create a formula with the syntax =AGGREGATE(function_num, options, array, [k]). The arguments in the syntax are as follows:

  • The function_num argument is the reference number of the function you want to use.
  • The options argument is the reference number for the options you want to use.
  • The array argument represents the cell range (array) that provides data for the formula.
  • The optional k argument, used with the LARGE, SMALL, PERCENTILE.INC, QUARTILE.INC, PERCENTILE.EXC, and QUARTILE.EXC, indicates which value, percentile, or quartile to return.

Feedback

Was this page helpful?

© 2025 Excel Insights.

All rights reserved.