AVERAGEVISIBLE

AVERAGEVISIBLE(rgeValues)
Returns the average value from the visible, non blank cells.

rgeValues

REMARKS
* This function excludes hidden cells caused by AutoFilter, Grouping or that have been Manually Hidden.
* You can use the built-in AVERAGE function to include hidden cells.
* You can use the user defined AVERAGEVISIBLEIFS function to returns the average value from only the visible, non blank cells that satisfy multiple conditions.
* You can use the user defined AVERAGETOP function to return
* You can use the user defined AVERAGEAVISIBLE function to returns the average value from the visible, non blank cells.
* Similar to the user defined functions COUNTVISIBLE, MAXVISIBLE, MEDIANVISIBLE, MINVISIBLE and SUMVISIBLE
Public Function AVERAGEVISIBLE( _

Public Function AVERAGEVISIBLE( _ 
         ByVal rgeValues As Range) _
         As Double

Dim rgeCell As Range
Dim itotalcells As Integer
Dim dbtotalvalue As Double
Dim dbaverage As Double
   
   Application.Volatile
   
   For Each rgeCell In rgeValues
   
      If (rgeCell.EntireRow.Hidden = False) And _
         (rgeCell.EntireColumn.Hidden = False) Then
         
         dbtotalvalue = dbtotalvalue + rgeCell.Value
         itotalcells = itotalcells + 1
      End If
   
   Next rgeCell
   
   dbaverage = (dbtotalvalue / itotalcells)
   
   AVERAGEVISIBLE = dbaverage
End Function

For instructions on how to add this function to a workbook refer to the page under Inserting Functions


© 2026 Better Solutions Limited. All Rights Reserved. © 2026 Better Solutions Limited TopPrevNext