How to Get the Maximum or Minimum Absolute Value in Excel

,

It is easy to find the maximum or minimum value in a batch of data in excel, but if this batch of numbers contains both positive and negative numbers, the maximum or minimum absolute value cannot be found out by basic MAX or MIN function in excel. This article will help you to solve this issue by using ABS function.

Prepare a table of numbers contains both positive and negative numbers:

Get the Maximum or Minimum Absolute Value 1

As we all know, compare the absolute values for positive number and negative number, actually we compare the values without negative sign, so|-11| is larger than |10|. How can we find out the maximum or minimum value among the positive and negative numbers? Please follow below steps.

1. Get the Maximum or Minimum Absolute Value in Excel

Step1: Select a blank cell, enter the formula =MAX(ABS(A1:C4)).

Get the Maximum or Minimum Absolute Value 2

Step2: Press Ctrl + Shift + Enter together, then the MAX absolute value is displayed.

Get the Maximum or Minimum Absolute Value 3

Step3: Use the similar formula to get the MIN absolute value. Enter the formula =MIN(ABS(A1:C4)).

Get the Maximum or Minimum Absolute Value 4

Step4: Press Ctrl + Shift + Enter together, then the MIN absolute value is displayed.

Get the Maximum or Minimum Absolute Value 5

2. Get the Maximum or Minimum Absolute Value by User Defined Function

We can also define a function like MINABS or MINABS then we can directly use it to find out the MAX or MIN absolute value. See steps below.

Step1: Click Developer tab->Visual Basic or Alt+F11 to load Microsoft Visual Basic for Applications window.

Step2: Click Insert->Module to insert a module.

Get the Maximum or Minimum Absolute Value 6

Step3: Enter below code in Module window.

Function GetMaxAbsValue(rng As Range) As Double
    Dim cell As Range
    Dim maxAbs As Double
    maxAbs = 0
    
    For Each cell In rng
        If Abs(cell.Value) > maxAbs Then
            maxAbs = Abs(cell.Value)
        End If
    Next cell
    
    GetMaxAbsValue = maxAbs
End Function

Function MinAbsoluteValue(rng As Range) As Double
    Dim cell As Range
    Dim minAbsValue As Double
    minAbsValue = Abs(rng.Cells(1, 1).Value)
    
    For Each cell In rng
        If Abs(cell.Value) < minAbsValue Then
            minAbsValue = Abs(cell.Value)
        End If
    Next cell
    
    MinAbsoluteValue = minAbsValue
End Function

Go back to your Excel workbook and use the custom function:

=GetMaxAbsValue(A1:C4)
=MinAbsoluteValue(A1:C4)

Press Enter to execute the VBA code and obtain the maximum or minimum absolute value.

The VBA code provides a flexible and customizable function to find the maximum or minimum absolute value in your specified range.

3. Video: Get the Maximum or Minimum Absolute Value

This Excel video tutorial where we’ll explore techniques to find the maximum or minimum absolute value in your data. Join us as we delve into two distinct methods for achieving this goal—utilizing Excel formulas and harnessing the power of VBA.

4. Related Functions

  • Excel ABS Function
    The Excel ABS function returns the absolute value of a number.The ABS function is a build-in function in Microsoft Excel and it is categorized as a Math and Trigonometry Function.The syntax of the ABS function is as below:=ABS (number)…
  • Excel MIN function
    The Excel MIN function returns the smallest numeric value from the numbers that you provided. Or returns the smallest value in the array.The MIN function is a build-in function in Microsoft Excel and it is categorized as a Statistical Function.The syntax of the MIN function is as below:= MIN(num1,[num2,…numn])….
  • Excel MAX function
    The Excel MAX function returns the largest numeric value from the numbers that you provided. Or returns the largest value in the array.= MAX(num1,[num2,…numn])…