跳到主要内容

MOD

返回数字被除数除后的余数。

语法

expression.MOD(arg1, arg2);

expression - 表示 ApiWorksheetFunction 类的变量。

参数

名称必需/可选数据类型默认值描述
arg1必需ApiRange | ApiName | number要除并求余数的数字。
arg2必需ApiRange | ApiName | number除数。

返回值

number

示例

此示例演示如何返回数字除以除数后的余数。

// How to get the modulo from the division.

// Use a function to calculate the remainder from the division operation.

let worksheet = Api.GetActiveSheet();
let func = Api.WorksheetFunction;
worksheet.GetRange("A1").SetValue(func.MOD(65, 7));