Note: The other languages of the website are Google-translated. Back to English

How to quickly average visible/filtered cells only in Excel?

Supposing you have a range of filtered data as below screenshot shown, and you just want to calculate the average of the visible data only. In Excel, if you use the common Average function, it will calculate the average on all the data including visible data and hidden data, but here I introduce some methods which can quickly average visible or filtered cells only in Excel for you.

doc average visible 1

Average visible cells only with User Defined Function

Average visible cells only with Kutools for Excel good idea3


Here, I introduce a User Defined Function for you to average visible cells only.

1. Press Alt + F11 keys to open the Microsoft Visual Basic for Applications window.

2. And click Insert > Module, then paste below VBA code to the new Module window.

VBA: Average visible/filtered cells only.

Function AverVisible(Rg As Range)
'UpdateByKutoolsforExcel20151208
    Dim xCell As Range
    Dim xCount As Integer
    Dim xTtl As Double
    Application.Volatile
    Set Rg = Intersect(Rg.Parent.UsedRange, Rg)
    For Each xCell In Rg
        If xCell.ColumnWidth > 0 _
          And xCell.RowHeight > 0 _
          And Not IsEmpty(xCell) _
          And IsNumeric(xCell.Value) Then
              xTtl = xTtl + xCell.Value
              xCount = xCount + 1
        End If
    Next
    If xCount > 0 Then
        AverVisible = xTtl / xCount
    Else
        AverVisible = 0
    End If
End Function

3. And save the code and close the Module window, and select a blank cell which out put the calculate result, type this formula =AverVisible(B3:B19), and press Enter key to get the correct result. See screenshots:

doc average visible 2
doc arrow
doc average visible 3

Tip: In the formula, B3:B19 is the filtered cells you want to calculate the average value, you can change it to your need.


With above User Defined Function, you may need to remember the code which is a little inconvenient for you. However, if you have installed Kutools for Excel – a handy tool with 120 useful functions, you can use its AVERAFEVISIBLE function to quickly and easily calculate the average in visible cells only.

Kutools for Excel, with more than 300 handy functions, makes your jobs more easier. 

After free installing Kutools for Excel, please do as below:

1. Select a cell which will put the average result in, and click Kutools > Kutools Functions > Statistical & Math > AVERAGEVISIBLE. See screenshot:

doc average visible 7

2. And then select the data range you want to calculate into Reference textbox in the Function Arguments dialog, then you can see the average result has been shown in the dialog. See screenshot:

doc average visible 5

3. Click OK, and the result is putted in the selected cell.

doc average visible 6

In Kutools Functions group, you also can count or sum visible cells only, and sum or count cells based on one color and so on.


Tabbed browsing & editing multiple Word documents/Excel workbooks as Firefox, Chrome, Internet Explore 10!

You may be familiar to view multiple webpages in Firefox/Chrome/IE, and switch between them by clicking corresponding tabs easily. Here, Office Tab supports similar processing, which allow you to browse multiple Word documents or Excel workbooks in one Word window or Excel window, and easily switch between them by clicking their tabs.
Click for free trial of Office Tab!

Browse multiple word documents in one window as Firefox

Relative Articles:


The Best Office Productivity Tools

Kutools for Excel Solves Most of Your Problems, and Increases Your Productivity by 80%

  • Reuse: Quickly insert complex formulas, charts and anything that you have used before; Encrypt Cells with password; Create Mailing List and send emails...
  • Super Formula Bar (easily edit multiple lines of text and formula); Reading Layout (easily read and edit large numbers of cells); Paste to Filtered Range...
  • Merge Cells/Rows/Columns without losing Data; Split Cells Content; Combine Duplicate Rows/Columns... Prevent Duplicate Cells; Compare Ranges...
  • Select Duplicate or Unique Rows; Select Blank Rows (all cells are empty); Super Find and Fuzzy Find in Many Workbooks; Random Select...
  • Exact Copy Multiple Cells without changing formula reference; Auto Create References to Multiple Sheets; Insert Bullets, Check Boxes and more...
  • Extract Text, Add Text, Remove by Position, Remove Space; Create and Print Paging Subtotals; Convert Between Cells Content and Comments...
  • Super Filter (save and apply filter schemes to other sheets); Advanced Sort by month/week/day, frequency and more; Special Filter by bold, italic...
  • Combine Workbooks and WorkSheets; Merge Tables based on key columns; Split Data into Multiple Sheets; Batch Convert xls, xlsx and PDF...
  • More than 300 powerful features. Supports Office / Excel 2007-2021 and 365. Supports all languages. Easy deploying in your enterprise or organization. Full features 30-day free trial. 60-day money back guarantee.
kte tab 201905

Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier

  • Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
  • Open and create multiple documents in new tabs of the same window, rather than in new windows.
  • Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!
officetab bottom
Comments (2)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
How can i do it for the Median
This comment was minimized by the moderator on the site
Do you mean to median the visible values? If so, try this formula =AGGREGATE(12,1,range)
There are no comments posted here yet

Follow Us

Copyright © 2009 - www.extendoffice.com. | All rights reserved. Powered by ExtendOffice. | Sitemap
Microsoft and the Office logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries.
Protected by Sectigo SSL