MAXVISIBLE

MAXVISIBLE(rgeValues)
Returns the largest value from the visible, non blank cells.

rgeValuesThe unit

REMARKS
* This function excludes hidden cells caused by AutoFilter, Grouping or that have been Manually Hidden.
* You can use the built-in MAX function to include hidden cells.
* You can use the user defined MAXVISIBLEA function to
* You can use the user defined MAXVISIBLEIFS function to
* Similar to the AVERAGEVISIBLE, COUNTVISIBLE, MINVISIBLE, MEDIANVISIBLE and SUMVISIBLE functions.

 A
1??

Public Function MAXVISIBLE( _ 
         ByVal rgeValues As Range) _
         As Double
Dim rgeCell As Range
Dim dbmax As Double
   Application.Volatile
   For Each rgeCell In rgeValues
      If (rgeCell.EntireRow.Hidden = False) And _
         (rgeCell.EntireColumn.Hidden = False) Then
         
         If (Len(rgeCell.Value) > 0) Then
            If (rgeCell.Value <> "True") And _
               (rgeCell.Value <> "False") And _
               (Application.WorksheetFunction.IsText(rgeCell.Value) <> True) Then

               If (dbmax = 0) Then
                  dbmax = rgeCell.Value
               End If
               If (rgeCell.Value > dbmax) Then
                  dbmax = rgeCell.Value
               End If
            End If
         End If
      End If
   Next rgeCell
   MAXVISIBLE = dbmax
End Function

Public Function MAXVISIBLE2( _
         ByVal rgeValues As Range) _
         As Double
Dim dbmax As Double
   dbmax = Application.WorksheetFunction.Aggregate(4, 5, rgeValues)
   MAXVISIBLE2 = dbmax
End Function

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