Calculating an Average of Visible Cells

Written by Allen Wyatt (last updated June 27, 2026)

1

Gary routinely filters data in a worksheet based on various criteria. He would like to calculate an average of the visible values in column C. In other words, when he filters the data, he wants the average of what is visible in column C after the filter is applied. Gary tried the AVERAGE function, but it seems to apply to all cells in column C regardless of their visibility.

There are several ways you can accomplish the task. First, Gary could convert his data to formal table and then add a total row. You can then select the total shown in column C, click the down-arrow next to the total, and choose Average. This will average just the visible values in the table, which is exactly what Gary wants.

The way that adding an average in a formal table is accomplished leads to the next option: using the SUBTOTAL function. If you perform the above steps for a formal table, you can see that Excel calculates the average using this function:

=SUBTOTAL(101,[Amount])

The second parameter is the name of the table column being averaged. There are two things to note here, however. First, SUBTOTAL doesn't work with just formal tables. You can specify a range that should be averaged by using the second parameter:

=SUBTOTAL(101,C2:C1000)

This means that the SUBTOTAL approach works great if you need your average somewhere else besides in a total row.

The second thing to note is the first parameter, in this case 101. The general idea of this parameter is to specify what you want returned by SUBTOTAL. If you want an average returned (as does Gary), then you can use a first parameter value of either 1 or 101. The difference between the two is in how SUBTOTAL handles manually hidden rows. If the value is 1, then manually hidden rows are included in the average. If the value is 101, then manually hidden rows are excluded from the average.

Understand that filtered rows are always ignored by SUBTOTAL; the first parameter only deals with manually hidden rows. This can cause some seemingly wonky results if your data includes both filtered rows and manually hidden rows. In that case, SUBTOTAL ignores all hidden rows, regardless of whether you use 1 or 101 as your first parameter.

If you are using Excel 2010 or a later version, you can use the AGGREGATE function instead of SUBTOTAL. Why would you want to do this? Primarily because AGGREGATE offers better control over what should be excluded from your average and it natively works with other array-based functions. There are three parameters that should be specified with AGGREGATE, in this manner:

=AGGREGATE(1,3,C2:C1000)

The first parameter indicates you want an average returned by the function. The second parameter indicates what you want to exclude from the calculation, as follows:

Option What to Ignore
0 SUBTOTAL and AGGREGATE functions
1 Hidden rows and SUBTOTAL and AGGREGATE functions
2 Error values and SUBTOTAL and AGGREGATE functions
3 Hidden rows, error values, and SUBTOTAL and AGGREGATE functions
4 Nothing
5 Hidden rows
6 Error values
7 Hidden rows and error values

To the AGGREGATE function, it doesn't matter how rows are hidden; filtered rows and manually hidden rows are treated the same. Whereas SUBTOTAL always excludes filtered rows, AGGREGATE only excludes them (along with manually hidden rows) if you set the second parameter to 1, 3, 5, or 7.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (13557) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, 2021, 2024, and Excel in Microsoft 365.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Special Characters In Hyperlinks

Do you use special characters (such as the pound sign) in your worksheet names? If so, you could run into problems ...

Discover More

Getting the Name of the Parent Workbook

If you need to insert into a cell the name of the workbook in which a worksheet is contained, you can use the CELL ...

Discover More

Changing Your Name

One of the many pieces of information that Excel keeps track of is your name. If you want to change your name for Excel's ...

Discover More

Professional Development Guidance! Four world-class developers offer start-to-finish guidance for building powerful, robust, and secure applications with Excel. The authors show how to consistently make the right design decisions and make the most of Excel's powerful features. Check out Professional Excel Development today!

More ExcelTips (ribbon)

Median of Selected Numbers

Need to find a median value in a series of values? It's easy with the MEDIAN function. What isn't as easy is to derive ...

Discover More

Limiting the Number of Results from a Function

Some of the newer functions in Excel can return quite a bit of information. If you want to limit what is returned, then ...

Discover More

Modifying Proper Capitalization

The PROPER worksheet function is used to change the case of text so that the first letter of each word is capitalized. If ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 3 + 7?

2026-06-27 11:21:55

J. Woolley

Here's another way, but it yields a static result:
1. Right-click the status bar and make sure Average is checked. (This does not need to be repeated.)
2. Select the range containing filtered cells.
3. The status bar includes an item labeled "Average: X" where X is the result.
4. Double-click the item labeled "Average: X" to copy the result to the clipboard.
5. Press Ctrl+V to paste the result where needed.


This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.