Max across columns?

  • Thread starter Thread starter David Billigmeier
  • Start date Start date
D

David Billigmeier

I need a function that will return the max across a set of columns, instead
of rows like the summary function MAX appears to do. So, I
need a function that would work similarly to:

(select max(5,2,9,3) from test)

and return 9

Thanks
 
David said:
I need a function that will return the max across a set of columns, instead
of rows like the summary function MAX appears to do. So, I
need a function that would work similarly to:

(select max(5,2,9,3) from test)

and return 9


Here's a user defined function you can use:

Public Function MaxOfList(ParamArray vValues() As Variant)
As Variant
Dim vX As Variant

MaxOfList = vValues(0)
For Each vX In vValues
If vX > Nz(MaxOfList, vX) Then MaxOfList = vX
Next vX

End Function
 
Back
Top