Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Max absolute value comand?? 3

Status
Not open for further replies.

SRO

Structural
Dec 27, 2001
103
0
0
US
Is there a comand to get the Max absolute value for a group of numbers. ie

1, 6, -14, 7 = 14
 
Replies continue below

Recommended for you

Type
Code:
=MAX(ABS(A1:A4))
and press Ctrl+Enter (enters it as an array formula). The formula now looks like:
Code:
{=MAX(ABS(A1:A4))}


Cheers,
Joerd

Please see FAQ731-376 for tips on how to make the best use of Eng-Tips.
 
Unfortunately, you cannot use =MAX(ABS(A1,D9,F7,E12)) and select the cells holding the Ctrl key, what you would normally do. I see nothing quicker than =MAX(ABS(A1),ABS(D9),ABS(F7),ABS(E12)) unless you venture into a VBA function, which will look something like:
Code:
Function MaxAbs(ParamArray R() As Variant)
Dim C As Variant, V As Double

    V = 0
    For Each C In R
        If Abs(C.Value) > V Then V = Abs(C.Value)
    Next C
    MaxAbs = V
End Function

Cheers,
Joerd

Please see FAQ731-376 for tips on how to make the best use of Eng-Tips.
 
Status
Not open for further replies.
Back
Top