Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Kyrsten,
Try a function like the following: Function MaxOfVariables(ParamArray V()) As Variant Dim N As Long Dim Max As Double If IsMissing(V) = True Then MaxOfVariables = CVErr(xlErrValue) Exit Function End If For N = LBound(V) To UBound(V) If IsNumeric(V(N)) Then If CDbl(V(N)) Max Then Max = CDbl(V(N)) End If Else MaxOfVariables = CVErr(xlErrNum) Exit Function End If Next N MaxOfVariables = Max End Function If no variables as passed to it, it will cause a #VALUE error. If any variable is not numeric, it returns a #NUM! error. If everything is numeric, it will return the maximum of the values passed in. Dim MyMax As Double MyMax = MaxOfVariables(a,b,c,d) -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com (email address is on the web site) "KyWilde" wrote in message ... I have a list of four varables: a, b, c, d all have integer values... I would like to figure out the maximum amount from the four. How can I do this? Is there a max(a,b,c,d) function I can use? Or do I need to write one? Thanks, -Kyrsten Wilde |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
MAXIMUM # OF X VARIABLES USED FOR MULTIVARIATE REGRESSION? | Excel Worksheet Functions | |||
How do I calculate maximum with variables. | Excel Worksheet Functions | |||
find maximum and minum variables for multiple names | Excel Worksheet Functions | |||
How do I find the maximum time value from a list | Excel Worksheet Functions | |||
maximum variables within sub | Excel Programming |