CEILING_MATH
Rounds a number up, to the nearest integer or to the nearest multiple of significance.
Syntax
expression.CEILING_MATH(arg1, arg2, arg3);
expression - A variable that represents a ApiWorksheetFunction class.
Parameters
| Name | Required/Optional | Data type | Default | Description |
|---|---|---|---|---|
| arg1 | Required | ApiRange | ApiName | number | The value to round up. | |
| arg2 | Optional | ApiRange | ApiName | number | The multiple of significance to round up to. If it is omitted, the default value of 1 is used. | |
| arg3 | Optional | ApiRange | ApiName | number | Specifies if negative numbers are rounded towards or away from zero. If it is omitted or set to 0, negative numbers are rounded towards zero. If any other numeric value is specified, negative numbers are rounded away from zero. |
Returns
number
Example
Round numbers up to the nearest whole value in a spreadsheet.
// What is the ceiling of a negative or positive number in a spreadsheet?
// Enforce upward rounding regardless of sign in a spreadsheet.
let worksheet = Api.GetActiveSheet();
let func = Api.WorksheetFunction;
worksheet.GetRange("A1").SetValue(func.CEILING_MATH(-5.5, 2, 1));