To average only visible (filtered) rows in Excel, use the SUBTOTAL function with function number 101. For example, if your numbers are in A2:A100, enter =SUBTOTAL(101,A2:A100) — it ignores rows hidden by a filter and returns the average of the visible cells. The AVERAGE function alone includes hidden rows, so it won’t give the filtered result you want.
What You’ll Need
- Microsoft Excel (Microsoft 365, Excel 2021, 2019, 2016, or earlier versions all support
SUBTOTAL). - A worksheet with data in a table or range, and a column you want to average.
- Filters already applied (via Data > Filter or by using an Excel Table’s filter arrows).
Step-by-Step
- Decide where the average will go. Click an empty cell outside the filtered data, for example E1.
- Type the SUBTOTAL formula. Enter
=SUBTOTAL(101,A2:A100)(adjust the range to match your data). The first argument, 101, tells Excel to average visible cells only. Press Enter. - Check the result. Excel shows the average of only the rows currently visible after filtering. If you change the filter, the result updates automatically.
- Alternative: use the status bar. Select the visible numbers in the column (drag over the filtered cells), and look at the status bar at the bottom-right of the Excel window — it shows “Average” for the selected visible cells. This is a quick check, not a permanent formula.
- For a permanent average that ignores hidden rows, use AGGREGATE. In Excel 2010 and later, you can also use
=AGGREGATE(1,7,A2:A100). The 1 means AVERAGE, and 7 tells it to ignore hidden rows and error values. This works the same as SUBTOTAL for filtered rows. - If you use an Excel Table (Insert > Table), the filter arrows are built in. The same SUBTOTAL formula works on the table column, e.g.,
=SUBTOTAL(101,Table1[Sales]).
Common Mistakes
- Using AVERAGE instead of SUBTOTAL.
=AVERAGE(A2:A100)includes rows hidden by a filter, giving a wrong result that changes only when you manually hide rows. - Using function number 1 instead of 101.
=SUBTOTAL(1,A2:A100)also ignores filtered rows, but it includes rows hidden manually (right-click > Hide). Use 101 to ignore all hidden rows, whether filtered or manually hidden. - Including the header row in the range. If your data starts in row 2, don’t include row 1 in the range, or the average will be skewed (especially if the header is text, SUBTOTAL will ignore it, but it’s still sloppy).
- Forgetting to update the range when adding data. If you add rows below the range, the formula won’t include them unless you expand the range or use a table.
- Expecting SUBTOTAL to ignore manually hidden rows when using 1. As noted, use 101 for that.
Tips
- Use an Excel Table (Ctrl+T) so your range automatically expands when you add data, and the SUBTOTAL formula can reference the table column by name.
- Combine with other functions. To average visible rows that meet a condition, use
SUBTOTALwith a helper column, or useAGGREGATEwith an array formula — but for most cases, SUBTOTAL is enough. - Quick average without a formula: Select the filtered cells and look at the status bar. Right-click the status bar to add “Average” if it’s not already shown.
- Use keyboard shortcuts: To toggle filters on/off, press Ctrl+Shift+L (Windows) or Cmd+Shift+L (Mac).
- For a dynamic average that updates with slicers (in Excel Tables or PivotTables), consider a PivotTable — it automatically averages only visible items.
Troubleshooting
- My SUBTOTAL result doesn’t change when I filter. Check that you used 101, not 1. Also ensure the range covers the filtered cells and that the filter is actually applied (look for the filter arrows on the column headers).
- I get a #DIV/0! error. This means no visible numeric cells are in the range. Either all rows are filtered out, or the range contains only text/empty cells. Clear the filter or adjust the range.
- The average includes hidden rows anyway. If you used SUBTOTAL with 101, it shouldn’t. But if you used AVERAGE, that’s the problem. Also, if rows are hidden by grouping (not filtering), SUBTOTAL with 101 still ignores them — that’s correct.
- My formula returns a different value than the status bar. The status bar average only considers the cells you selected. If your formula range includes extra cells, the result differs. Double-check the range.
- On Mac, the shortcut for filters is Cmd+Shift+L. Everything else works the same.
Frequently Asked Questions
Q: Does SUBTOTAL work with Excel for the web?
Yes, SUBTOTAL is supported in Excel for the web. The formula works the same, but keyboard shortcuts may differ (e.g., filter toggle is Alt+Down Arrow on the header).
Q: Can I average filtered rows that meet a condition, like only sales over $100?
Yes, but you’ll need to combine SUBTOTAL with an array formula or use AGGREGATE with a condition. A simpler approach is to add a helper column that flags rows meeting the condition, then filter on that column and use SUBTOTAL on the original values.
Q: What’s the difference between SUBTOTAL(1,…) and SUBTOTAL(101,…)?
Both ignore rows hidden by filtering. The difference is that 1 also includes rows hidden manually (right-click > Hide), while 101 ignores all hidden rows — including manually hidden ones. For filtered data, either works, but 101 is safer.
Q: How do I average visible cells only without typing a formula?
Select the visible cells, and the status bar shows the average. If it doesn’t, right-click the status bar and check “Average.” This is a quick read, not a permanent cell value.
Q: Can I use SUBTOTAL inside another function, like IF?
Yes, but it gets complex. For example, to average visible rows where column B is “Yes”, you could use an array formula with SUMPRODUCT and SUBTOTAL, but it’s easier to filter and then use SUBTOTAL on the filtered range.
Q: Does AGGREGATE work the same as SUBTOTAL for filtered rows?
Yes, AGGREGATE with function 1 and option 7 (ignore hidden rows) gives the same result as SUBTOTAL(101,…). AGGREGATE also lets you ignore error values, which SUBTOTAL cannot.
Related
- Google Sheets Sum of Filtered Column: 3 Easy Ways
- Excel SUBTOTAL AVERAGE: Average Filtered Data
- Number Rows in Excel When Filtered
Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.
More in How-to basics
- Free Savings Tracker Google Sheets: Set Up a Simple SheetYes. You can make a free savings tracker in Google Sheets by starting with a blank spreadsheet, recording…
- Excel conditional formatting based on another cell?Learn Excel conditional formatting from another cell with formula rules, reference examples, and fixes for common problems, so…
- Excel Power Query Wrap Text: How to Do ItThe short answer: Power Query does not have a direct “wrap text” button, but you can force wrapped…
- Schedule an Email Reminder in Outlook: Step-by-StepTo get a reminder to follow up on an Outlook email, flag the message and set a reminder…
- How to Alphabetize Tabs in Google SheetsGoogle Sheets does not have a built-in command to alphabetize sheet tabs. For a few tabs, drag them…
- Ctrl+E in Excel: What the Shortcut Does and How to Use ItIn Excel for Microsoft 365 on Windows, Ctrl+E runs Flash Fill. Flash Fill recognizes a pattern in your…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.