Tip: Other languages are Google-Translated. You can visit the English version of this link.
Log in
x
or
x
x
Register
x

or

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

Sum/Average/Count visible cells/Filtered only in Excel

Only calculate the visible cells and skip the hidden cells.  Click for 60 days free trial!
doc sumvisible
 
Kutools for Excel: with more than 200 handy Excel add-ins, free to try with no limitation in 60 days.

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 200 handy Excel functions, enhance your working efficiency and save your working time.

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:


Recommended Productivity Tools

Ribbon of Excel (with Kutools for Excel installed)

300+ Advanced Features Increase Your Productivity by 71%, and Help You To Stand Out From Crowd!

Would you like to complete your daily work quickly and perfectly? Kutools For Excel brings 300+ cool and powerful advanced features (Combine workbooks, sum by color, split cell contents, convert date, and so on...) for 1500+ work scenarios, helps you solve 82% Excel problems.

  •  Deal with all complicated tasks in seconds, help to enhance your work ability, get success from the fierce competition, and never worry about being fired.
  •  Save a lot of work time, leave much time for you to love and care the family and enjoy a comfortable life now.
  •  Reduce thousands of keyboard and mouse clicks every day, relieve your tired eyes and hands, and give you a healthy body.
  •  Become an Excel expert in 3 minutes, and get admiring glance from your colleagues or friends.
  •  No longer need to remember any painful formulas and VBA codes, have a relaxing and pleasant mind, give you a thrill you've never had before.
  •  Spend only $39, but worth than $4000 training of others. Being used by 110,000 elites and 300+ well-known companies.
  •  60-day unlimited free trial. 60-day money back guarantee. Free upgrade and support for 2 years. Buy once, use forever.
  •  Change the way you work now, and give you a better life immediately!

Office Tab Brings Efficient And Handy Tabs to Office (include Excel), Just Like Chrome, Firefox, And New IE

  • Increases your productivity by 50% when viewing and editing multiple documents.
  • Reduce hundreds of mouse clicks for you every day, say goodbye to mouse hand.
  • Open and create documents in new tabs of same window, rather than in new windows.
  • Help you work faster and easily stand out from the crowd! One second to switch between dozens of open documents!
Say something here...
symbols left.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.
  • To post as a guest, your comment is unpublished.
    rana · 11 months ago
    How can i do it for the Median
    • To post as a guest, your comment is unpublished.
      Sunny · 10 months ago
      Do you mean to median the visible values? If so, try this formula =AGGREGATE(12,1,range)