Skip to main content

ABS

Returns the absolute value of a number, a number without its sign.

Syntax

expression.ABS(arg1);

expression - A variable that represents a ApiWorksheetFunction class.

Parameters

NameRequired/OptionalData typeDefaultDescription
arg1RequiredApiRange | ApiName | numberThe real number for which the absolute value will be returned.

Returns

number

Example

Find the absolute value of a number in a spreadsheet.

// How do I convert a negative number to positive in a spreadsheet?

// Discard the sign and use only the magnitude of any value in a spreadsheet.

let worksheet = Api.GetActiveSheet();
let func = Api.WorksheetFunction;
worksheet.GetRange("A1").SetValue(func.ABS(-123.14));