跳到主要内容

COMBINA

返回给定项目数的可重复组合数。

语法

expression.COMBINA(arg1, arg2);

expression - 表示 ApiWorksheetFunction 类的变量。

参数

名称必需/可选数据类型默认值描述
arg1必需ApiRange | ApiName | number项目总数,一个大于或等于 0 的数值。
arg2必需ApiRange | ApiName | number每个组合中的项目数,一个大于或等于 0 但小于项目总数的数值。

返回值

number

示例

此示例演示如何返回给定项目数的可重复组合数。

// How to find a number of combinations with repetitions.

// Use function to count possible combinations with duplicates for a given number of items.

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