The SUBTOTAL function in Excel can calculate the average of visible cells in a filtered list, ignoring hidden rows. This is essential when working with filtered data where you need an accurate average that excludes manually or automatically hidden rows. Unlike AVERAGE, which includes all cells in the range, SUBTOTAL with function number 1 or 101 dynamically adjusts to show only the average of what’s currently visible. You need data organized in a table or range with column headers and filters applied to use this effectively.

What You'll Need

  • A Microsoft Excel spreadsheet (2007 or later)
  • A range of numeric data with at least one column of values to average
  • Filters enabled on your data range (Data > Filter)
  • Access to the formula bar and cell selection

Step-by-Step

  1. Ensure your data has headers. Click any cell inside your data range, then go to the Data tab and select Filter. This adds dropdown arrows to each column header.
  2. Apply a filter by clicking the dropdown arrow in the column you want to filter by, then select the criteria (e.g., show only values greater than 100 or only from a specific region).
  3. Click on an empty cell below or beside your data where you want the average to appear. This cell should not be part of the filtered data range to avoid confusion.
  4. Type the formula: =SUBTOTAL(1, range). Replace range with the actual cell range of the column you want to average (e.g., =SUBTOTAL(1, B2:B100)).
  5. Press Enter. Excel will calculate the average of only the visible rows in that range, ignoring any rows hidden by the filter.
  6. To verify it's working, change your filter criteria (e.g., hide some rows or show more). Watch the result update automatically without editing the formula.
  7. If you later convert your range to an Excel Table (Select range > Insert > Table), the SUBTOTAL formula will still work and automatically adjust if you add new rows.

Common Mistakes

  • Using AVERAGE instead of SUBTOTAL: The AVERAGE function includes hidden rows and gives incorrect results when filters are applied.
  • Using function number 101 instead of 1: Both work for average, but 1 ignores manually hidden rows while 101 ignores all hidden rows (including those hidden by filters). For filtered data, use 1 — it’s the standard for dynamic filtering.
  • Referencing the wrong range: If your data has blank rows or merged cells, selecting an incorrect range may include unintended cells. Always double-check the range includes only the numeric column you want to average.
  • Typing SUBTOTAL as SUB TOTAL or using wrong syntax: Excel will return a #NAME? error if the function name is misspelled or if parentheses are missing.
  • Expecting SUBTOTAL to work on unfiltered data: If no rows are hidden, SUBTOTAL(1, range) behaves like AVERAGE. It only becomes useful when filtering hides rows.

Tips

  • Use 101 instead of 1 if you also manually hide rows and want those excluded too — for example, if you’re reviewing data and want to temporarily hide outliers.
  • Combine SUBTOTAL with other functions like COUNTA to get both the average and count of visible items in one report.
  • When working with large datasets, name your data range (Formulas > Define Name) and use the name in your formula (e.g., =SUBTOTAL(1, SalesData)) for easier reading and maintenance.
  • Use Conditional Formatting to highlight the SUBTOTAL result cell so it stands out from raw data.
  • Always test your formula by hiding a few rows manually and verifying the average changes. If it doesn’t, you likely used AVERAGE or the wrong function number.
  • For grouped data (e.g., subtotals per region), consider using Pivot Tables instead — they offer built-in averaging and are more scalable.

Troubleshooting

  • #NAME? error: This means Excel doesn’t recognize "SUBTOTAL". Check spelling. Ensure you typed "SUBTOTAL" and not "SUB TOTAL" or "subtotal" (case doesn’t matter, but spelling does).
  • #VALUE! error: Your range includes text or error values. Use the FILTER function (in newer Excel versions) to clean data first, or wrap the range in IFERROR to exclude non-numeric cells.
  • Average doesn’t update when filtering: You may have forgotten to enable filters. Go to Data > Filter and ensure the dropdown arrows appear on headers. Also confirm you’re using SUBTOTAL(1, range) and not AVERAGE.
  • Formula returns 0: This usually means all visible rows contain zero or blank values. Check your filter criteria — you may be hiding all numeric data.
  • Formula doesn’t adjust when adding new rows: If your data isn’t in an Excel Table, adding rows won’t auto-extend the range. Convert your range to a Table (Ctrl+T) so the SUBTOTAL formula expands automatically.

Frequently Asked Questions

Can I use SUBTOTAL for average on non-numeric data?

No. SUBTOTAL(1, range) only works with numeric values. If your range includes text, blanks, or errors, they are ignored, but if all values are non-numeric, the result will be 0 or #DIV/0! if no valid numbers exist.

Does SUBTOTAL work with filtered Pivot Tables?

No. Pivot Tables have their own built-in calculation options. Use the PivotTable Fields pane to set summarization to "Average" instead of relying on SUBTOTAL.

What’s the difference between SUBTOTAL(1, range) and SUBTOTAL(101, range)?

Function number 1 ignores manually hidden rows but includes those hidden by filters. Function number 101 ignores both manually hidden and filter-hidden rows. For most users filtering data, 1 is the correct choice.

Can I use SUBTOTAL with multiple columns at once?

No. SUBTOTAL works on one range at a time. To average multiple columns, create a separate SUBTOTAL formula for each column.

Why does my SUBTOTAL formula show a different number than AVERAGE?

Because SUBTOTAL excludes hidden rows. If you’ve filtered your data and hidden some rows, AVERAGE includes them while SUBTOTAL does not — this is intentional and correct behavior.

Is SUBTOTAL available in Excel Online or Google Sheets?

Yes, Excel Online supports SUBTOTAL. Google Sheets uses a similar function called AVERAGEIF or FILTER with AVERAGE, but does not have a direct SUBTOTAL equivalent — use FILTER to isolate visible rows first.