TRY NEW VERSION

NEGBINOMDIST

NEGBINOMDIST(arg1, arg2, arg3) → { number }

Returns the negative binomial distribution, the probability that there will be the specified number of failures before the last success, with the specified probability of a success.

Parameters:

Name Type Description
arg1 number

The number of failures.

arg2 number

The threshold number of successes.

arg3 number

The probability of a success; a number between 0 and 1.

Returns:

Type
number

Example

Copy code
builder.CreateFile("xlsx");

const oWorksheet = Api.GetActiveSheet();

var valueArr = [6, 32, 0.7];

// Place the numbers in cells
for (var i = 0; i < valueArr.length; i++) {
  oWorksheet.GetRange("A" + (i + 1)).SetValue(valueArr[i]);
}

//method params
var numberF = oWorksheet.GetRange("A1").GetValue();
var numberS = oWorksheet.GetRange("A2").GetValue();
var probabilityS = oWorksheet.GetRange("A3").GetValue();

var oFunction = Api.GetWorksheetFunction();
var ans = oFunction.NEGBINOMDIST(numberF, numberS, probabilityS);

oWorksheet.GetRange("C1").SetValue(ans);

builder.SaveFile("xlsx", "NEGBINOMDIST.xlsx");
builder.CloseFile();

Resulting document