Excel ABS Function

The Excel ABS function returns the absolute value of a number

Example: Excel ABS Function

Excel ABS Function

METHOD 1. Excel ABS Function using hardcoded values

EXCEL

=ABS(-115)
Result in cell C5 (115) - returns an absolute value of -115, therefore, it converts a negative to a positive number.

=ABS(115)
Result in cell C6 (115) - returns the same number as entered into the function, given the value is already a positive number.

METHOD 2. Excel ABS Function using links

EXCEL

=ABS(B5)
Result in cell C5 (115) - returns an absolute value of the number in cell B5, therefore, it converts a negative to a positive number.

=ABS(B6)
Result in cell C6 (115) - returns the same number that is captured in cell B6, given the value is already a positive number.

METHOD 3. Excel ABS function using the Excel built-in function library with hardcoded values

EXCEL

Formulas tab > Function Library group > Math & Trig > ABS > populate the input box

=ABS(-115)
Note: in this example we are converting -115 into a positive number.
Built-in Excel ABS Function using hardocded values

METHOD 4. Excel ABS function using the Excel built-in function library with links

EXCEL

Formulas tab > Function Library group > Math & Trig > ABS > populate the input boxes

=ABS(B6)
Note: in this example we are converting the number captured in cell B5 (-115) into a positive number.
Built-in Excel ABS Function using links

METHOD 1. Excel ABS function using VBA with hardcoded values

VBA

Sub Excel_ABS_Function()
'declare a variable
Dim ws As Worksheet
Set ws = Worksheets("ABS")

'apply the Excel ABS function
ws.Range("C5") = Abs(-115)
ws.Range("C6") = Abs(115)

End Sub

OBJECTS
Worksheets: The Worksheets object represents all of the worksheets in a workbook, excluding chart sheets.
Range: The Range object is a representation of a single cell or a range of cells in a worksheet.
PREREQUISITES
Worksheet Name: Have a worksheet named ABS.

ADJUSTABLE PARAMETERS
Output Range: Select the output range by changing the cell references ("C5") and ("C6") in the VBA code to any cell in the worksheet, that doesn't conflict with the formula.

METHOD 2. Excel ABS function using VBA with links

VBA

Sub Excel_ABS_Function()
'declare a variable
Dim ws As Worksheet
Set ws = Worksheets("ABS")

'apply the Excel ABS function
ws.Range("C5") = Abs(ws.Range("B5"))
ws.Range("C6") = Abs(ws.Range("B6"))

End Sub

OBJECTS
Worksheets: The Worksheets object represents all of the worksheets in a workbook, excluding chart sheets.
Range: The Range object is a representation of a single cell or a range of cells in a worksheet.
PREREQUISITES
Worksheet Name: Have a worksheet named ABS.
Numbers: If using the exact same VBA code you need to ensure that the numbers that you want to be returned as absolute values are to be captured in range ("B5:B6").

ADJUSTABLE PARAMETERS
Output Range: Select the output range by changing the cell references ("C5") and ("C6") in the VBA code to any cell in the worksheet, that doesn't conflict with the formula.
Numbers: Select the numbers for which you want to return absolute values by changing range ("B5:B6").

Usage of the Excel ABS function and formula syntax

EXPLANATION

DESCRIPTION
The Excel ABS function returns the absolute value of a number. Therefore, using this function you can convert a negative number to a positive number. A positive number will remain unchanged.
SYNTAX
=ABS(number)

ARGUMENTS
number: (Required) A numeric value to be calculated as an absolute value.