跳到主要内容

SUMSQ

返回参数的平方和。

语法

expression.SUMSQ(args);

expression - 表示 ApiWorksheetFunction 类的变量。

参数

名称必需/可选数据类型默认值描述
args必需ApiRange | ApiName | number | string | boolean | (number | string | boolean)[]最多 255 个将计算平方和的数值。第一个参数是必需的,后续参数是可选的。参数可以是数字、名称、逻辑值或数字的文本表示形式、包含数字的单元格区域或数组。

返回值

number

示例

此示例演示如何返回参数的平方和。

// How to calculate the sum of the squares.

// Use a function to estimate the sum of the squares.

let worksheet = Api.GetActiveSheet();
let func = Api.WorksheetFunction;
worksheet.GetRange("A1").SetValue(func.SUMSQ(1, 0, 0, 0, 4, 1, 0, 0, 2, 3, 6, 7, 6, 8, 10, 12));