Contact

NEGBINOM.DIST in ONLYOFFICE: Failures Before a Fixed Number of Successes

Statistical Intermediate ONLYOFFICE

Use NEGBINOM.DIST with clear model inputs, independently calculated examples, exact-version source limits and compatibility guidance.

Verification status: See the evidence and test scope described in this guide. How formula examples are checked

=NEGBINOM.DIST(2,3,0.5,FALSE) has the independent target 0.1875. TRUE instead gives 0.5, the probability of at most two failures before the third success.

Syntax

NEGBINOM.DIST(number_f, number_s, probability_s, cumulative)

Set up a fixed-success experiment

Create SuccessTrials with Parameter in A1 and Value in B1. Put Required successes in A2 and 3 in B2; Success probability in A3 and 0.5 in B3; Failures of interest in A4 and 2 in B4. The example models independent trials with the same success probability, stopping when the third success occurs.

The random count is failures before that third success. Two failures means the stopping trial is trial 5: three successes plus two failures. It does not mean two total trials, nor the number of successes in a fixed batch. A fixed-trial success count instead belongs to a binomial model. Independence and constant success probability are assumptions, not results supplied by the function.

Distinguish point mass from cumulative probability

The official syntax has four arguments. FALSE returns the probability of exactly f failures before the r-th success; TRUE sums the masses from 0 through f. The help labels FALSE a probability density, but for this discrete count model it is a probability mass.

The point-mass formula is C(f+r−1,r−1) p^r (1−p)^f. The final trial must be the r-th success, so the combinations count arrangements only among the preceding f+r−1 trials. Using C(f+r,r) instead would count sequences that do not stop at the specified trial.

Worked integer counts

Cell Formula Independent target
D2 =NEGBINOM.DIST(B4,B2,B3,FALSE) 0.1875
D3 =NEGBINOM.DIST(B4,B2,B3,TRUE) 0.5
D4 =NEGBINOM.DIST(0,B2,B3,FALSE) 0.125
D5 =NEGBINOM.DIST(1,B2,B3,FALSE) 0.1875
D6 =NEGBINOM.DIST(3,B2,B3,FALSE) 0.15625
D7 =1-D3 0.5

For D2, C(4,2)=6 and each admissible five-trial sequence has probability 0.5^5=1/32, so the mass is 6/32=0.1875. D3 adds 0.125+0.1875+0.1875=0.5. D7 is more than two failures; for at least two failures, subtract the CDF at 1 instead, yielding 0.6875.

Advanced: recover an interval from cumulative values

=NEGBINOM.DIST(3,3,0.5,TRUE)-NEGBINOM.DIST(0,3,0.5,TRUE) has independent target 0.53125 for one through three failures. The subtraction uses 0, one less than the lower included count. Subtracting the CDF at 1 would exclude the one-failure mass too.

The expected failures for this model are r(1−p)/p=3; expected total trials are r/p=6. These are different random quantities. The mean does not imply that exactly three failures is the most likely outcome, and it does not guarantee a stopping time in any one run.

Source bounds, fractional counts and the legacy name

The tagged implementation applies parseInt to both count arguments before checking bounds. Use nonnegative integer failures and positive integer successes in models. Ordinary positive fractional counts are truncated in this path; do not exploit that behavior to hide an invalid count or assume it applies identically to enormous scientific-notation values.

The code rejects f<0, r<1 or p outside [0,1] after its count conversion. Help instead describes p strictly between 0 and 1. For integer counts, source boundary predictions include mass 1 at f=0,p=1 and mass 0 at f=2,p=1; p=0 gives mass and finite-threshold CDF 0 when r≥1. The p=0 model never reaches the required successes, so this boundary is not an ordinary finite stopping-time experiment.

NEGBINOMDIST has only three arguments and returns point mass. It does not apply this explicit count parsing before the expression; fractional values can therefore differ. It is not a complete alias of the modern four-argument function.

The modern CDF uses a beta-distribution helper, not an explicit loop over these masses. Small-count direct sums independently validate the mathematical targets, but do not certify extreme-tail accuracy or all helper convergence behavior. Use explicit logical modes, clean numeric inputs and bounded counts; array-oriented source helpers are not a native spill claim.

Version, precision and verification

Checked October 18, 2026 against current official help and SDKJS tag v10.0.0.169, commit 3679e0375a758d7dc59d31337a45461be3525ed8. Introduction dates and a final supported-version endpoint are not established. Desktop Editors, Docs, mobile releases and imported files require separate compatibility checks.

Neither the ONLYOFFICE application nor its calculation engine was executed for this guide. The numerical targets are independently calculated mathematical values; code-path and error observations are manual source traces. They are not screenshots, displayed workbook results or promises of identical final digits. Use English function names and comma separators as shown, adapting separators to the editor’s locale.

Keep inputs and intermediate probabilities numeric and unrounded. Format the display rather than replacing values with rounded strings. These moderate scalar examples do not certify extreme-tail accuracy, unusual type coercion, array entry or dynamic spill. Model assumptions must be checked separately from arithmetic correctness.