Statistical functions

PERMUTATIONA

Close: 4 of 71,919 recorded answers differ in the last bits, worst 1 ULP

Everything else matches (71,915 in the answer bank and 4 workbook cells). Last-bit means a finite number within 16 ULP of Excel's. How we measure this · See the Rust code

Local names in 40 languages
LanguageName in Excel
ArabicPERMUTATIONA
BulgarianPERMUTATIONA
CzechPERMUTATIONA
DanishPERMUTATIONA
GermanPERMUTATIONA
GreekPERMUTATIONA
English (Australia)PERMUTATIONA
English (United Kingdom)PERMUTATIONA
English (United States)PERMUTATIONA
SpanishPERMUTACIONES.A
EstonianPERMUTATIONA
FinnishPERMUTAATIOA
FrenchPERMUTATIONA
HebrewPERMUTATIONA
CroatianPERMUTATIONA
HungarianVARIÁCIÓK.ISM
IndonesianPERMUTATIONA
ItalianPERMUTATIONA
JapanesePERMUTATIONA
KoreanPERMUTATIONA
LithuanianPERMUTATIONA
LatvianPERMUTATIONA
NorwegianPERMUTATIONA
DutchPERMUTATIE.A
PolishPERMUTACJE.A
Portuguese (Brazil)PERMUTATIONA
Portuguese (Portugal)PERMUTAR.R
RomanianPERMUTATIONA
RussianПЕРЕСТА
SlovakPERMUTATIONA
SlovenianPERMUTATIONA
Serbian (Latin)PERMUTATIONA
SwedishPERMUTATIONA
ThaiPERMUTATIONA
TurkishPERMÜTASYONA
UkrainianPERMUTATIONA
VietnamesePERMUTATIONA
Chinese (Simplified)PERMUTATIONA
Chinese (Hong Kong)PERMUTATIONA
Chinese (Traditional)PERMUTATIONA

Names from Microsoft's support site.

What it does

PERMUTATIONA(number, number_chosen)

PERMUTATIONA(number, number_chosen) counts the ordered arrangements of number_chosen objects drawn from number objects with repetition allowed.

Writing n for number and k for number_chosen, Microsoft states the equation directly:

PERMUTATIONA(n, k) = n^k

The derivation is the one-line one: each of the k positions is filled independently from all n objects, so the arrangements are the functions from a k-element set into an n-element set, and there are n^k of them. Combinatorially this is the size of Sⁿ raised to the sequence length — the count of words of length k over an alphabet of size n.

Domain and range. After truncation to integers the documented domain is n ≥ 0, k ≥ 0, with the single excluded corner n = 0, k > 0 (there are no words of positive length over an empty alphabet). On that domain the value is a positive integer. Boundary identities:

PERMUTATIONA(n, 0) = 1        for every n ≥ 0, including n = 0
PERMUTATIONA(n, 1) = n
PERMUTATIONA(1, k) = 1
PERMUTATIONA(0, 0) = 1        the empty word; documented as admissible

Unlike PERMUT, this function has no upper constraint linking k to n: k may exceed n freely, and does in the natural applications — how many four-digit PINs (n = 10, k = 4), how many length-k passwords over a character set.

Growth is exponential in k, so the representable range is narrow: the largest finite double is reached when k log n passes about 709.78 in natural logarithm, or equivalently when n^k exceeds roughly 1.798 × 10^308. In practice the overflow boundary arrives at modest inputs, and how it is reported is a real part of this function's behaviour rather than an afterthought.

Arguments

ArgumentMeaningDefault
numberThe size of the pool the objects are drawn from. Required.—
number_chosenThe length of the arrangement. Required.—

Microsoft describes both as integers and states that both arguments are truncated to integers. Truncation happens before validation, so PERMUTATIONA(2.9, 3.9) is the same call as PERMUTATIONA(2, 3).

Try it

Input cells (optional)

Example: {"B2": 3, "B3": 4}. A1 holds the formula. Other cells need values before a formula can read them.

Enter a formula, then calculate.

Runs locally in your browser with OneCalc. Its answer may differ from Excel. Use English function names and commas between arguments.

Quirks

Result and edge cases

Returns Number.

  • k = 0 returns 1 for every admissible n, including n = 0. Microsoft's own remark makes this explicit by scoping the error to the case where "the total number is zero (0) and the chosen number is larger than zero (0)" — the corner is excluded, not the whole n = 0 column.
  • k > n is ordinary, not an error. This is the sharpest behavioural difference from PERMUT, where number < number_chosen is a documented #NUM!.

Errors

As documented by Microsoft on the PERMUTATIONA page (retrieved for this page):

ErrorDocumented condition
#NUM!The numeric arguments are not valid — the example given is number = 0 with number_chosen > 0
#VALUE!An argument uses a nonnumeric data type

The #NUM! row is documented by example rather than by a complete inequality, which is a real gap: the page states one invalid combination and says "for example". The negative-argument cases are therefore documented only by implication.

Error values arriving in either argument propagate under the ordinary coercion rules; see Coercion and lifting.

The suffix that means something else here

PERMUTATIONA looks like it belongs to the AVERAGEA / COUNTA / MAXA / MINA / STDEVA / VARA group, where a trailing A marks a variant that admits text and logical values into a scan that the base function ignores. It does not. Here — and on COMBINA — the A marks repetition allowed. Two unrelated naming conventions share one letter, and this is the pair that catches people, because PERMUTATIONA is a statistical-category function sitting alphabetically beside genuine A-variants.

How to implement

Numerical notes

The mathematics is a power of an integer, and the numerics is entirely about how that power is formed.

  1. pow and repeated multiplication are different functions in floating point. For integer k, exp(k · log n) — what a general pow does internally, in one form or another — accumulates the error of a logarithm and an exponential, amplified by k. Repeated multiplication accumulates k-1 roundings but never leaves the integers while the result is below 2^53. Binary exponentiation (square-and-multiply) is a third answer again: it uses about log₂ k multiplications and rounds at different places. For results below 2^53 all three agree, because the exact integer is representable; above it they generally do not. An implementation that quietly delegates to the platform pow has chosen one of these and should say so.
  2. The exact regime is worth detecting. n^k < 2^53 covers most real spreadsheet uses, and in that regime the correct answer is an exact integer that any careful staging reaches. Getting the boundary right — and returning the exactly rounded value just past it — is more valuable than shaving a multiply.
  3. Overflow must be detected before it happens, not after. Computing n^k and then testing the result for infinity works on a platform with IEEE default rounding and no traps, but it throws away the information needed to distinguish "genuinely too large" from "intermediate overflowed while the final result would have been fine" — a distinction that matters for PERMUT and does not arise here, since n^k is monotone in both arguments. The cheap pre-test is k · log₂ n > 1024.
  4. Underflow does not arise: with n ≥ 1 the result is at least 1, and n = 0 is either the empty-word corner or the documented error.

The Handbook does not assert what Excel does internally for this surface. EV-MATH-0008 tells us where Excel places an error code, with named witnesses; it does not identify an op-graph, and it publishes no numeric comparison for this surface.

Rust code

Show the CalcFunc source of this function

Quoted from the public repository DnaCalc/DnaCalc, crates calc-func and calc-fml, at commit 9e1884369a67. Comments are the source's own. A kernel shared with other functions appears once, on its module page.

PERMUTATIONA · 3 lines · calc-func/src/catalogue/math.rs on GitHub
37 permutationa "PERMUTATIONA" (2, 2) [V "number", V "number_chosen"] |s, a, sv| {
    binary(s, a, k::permutationa_fn::permutationa_kernel)
}
permutationa_kernel · 29 lines · calc-func/src/ported/permutationa_fn.rs on GitHub
/// PERMUTATIONA: n to the power k, both truncated, by repeated squaring (10^k by decimal
/// conversion); #NUM! outside the admitted domain.
pub fn permutationa_kernel(n: f64, k: f64) -> Result<f64, WorksheetErrorCode> {
    // W111 distinguishes raw-base admission from exponent truncation:
    // a negative fractional base is invalid, but -1 < k < 0 truncates to zero.
    if !n.is_finite() || !k.is_finite() || n < 0.0 || n >= 2147483647.0
        || k >= 2147483647.0 || k.trunc() < 0.0 {
        return Err(WorksheetErrorCode::Num);
    }
    let n = n.trunc();
    let mut k = k.trunc() as u32;
    // The base-ten branch agrees with decimal power conversion, distinguishable
    // from repeated squaring at 10^99, 10^100 and later powers. Fresh validation
    // covers the full finite decimal exponent range before any parity promotion.
    let result = if n == 10.0 {
        if k > 308 { f64::INFINITY }
        else { format!("1e{k}").parse().unwrap_or(f64::INFINITY) }
    } else {
        let mut result = 1.0;
        let mut base = n;
        while k > 0 {
            if k & 1 != 0 { result = crate::ported::excel_numeric::excel_x87_mul(result, base); }
            k >>= 1;
            if k > 0 { base = crate::ported::excel_numeric::excel_x87_mul(base, base); }
        }
        result
    };
    ExcelRealPolicy::FINITE.publish(n, result)
}

Kernels shared with other functions

Argument and result plumbing

  • num catalogue/kit
  • out catalogue/kit

No implementation has been published with a Handbook test suite for this function.

Version differences

The recorded environments below distinguish a reading from a same-input comparison. Counts describe captured inputs in each environment; overlapping captures and comparisons are not totals of unique worksheet calls.

Excel 16.0 buildPlatform and CPUCaptured inputs
19929Windows, bitness not recorded, CPU not recorded133
20430Windows, 64-bit, CPU not recorded71,915
  • XC-PERMUTATIONA-001: build 19929 versus build 20430; 21 same-input pairs, 0 differing answers. Compared axes: excel-build. Numeric answers were compared by their recorded binary64 bits; other answers by typed value.

Agreement on these compared inputs does not establish agreement on unmeasured inputs.

Recorded environments and comparison details.

Excel 16.0 build 19929

Windows, bitness not recorded, CPU not recorded

133 captured inputs are indexed for this environment. Capture dates are not recorded. This is a reading count, not a comparison with another build.

Excel 16.0 build 20430

Windows, 64-bit, CPU not recorded

71,915 captured inputs are indexed for this environment. Capture dates: 2026-09-29 to 2026-09-29. This is a reading count, not a comparison with another build.

Alternatives

Relationships

  • PERMUT is the same count without repetition — the falling factorial n(n-1)…(n-k+1) — and requires k ≤ n. The two agree at k = 0 and k = 1 and diverge thereafter, with PERMUTATIONA(n, k) ≥ PERMUT(n, k) always.
  • COMBIN and COMBINA are the unordered counterparts, completing the standard two-by-two grid: ordered/unordered against with/without replacement. COMBINA(n, k) counts multisets and equals COMBIN(n+k-1, k).
  • POWER and the ^ operator compute the same mathematical quantity for integer n and k. This is not a decorative observation: PERMUTATIONA(n, k) and POWER(n, k) are two Excel surfaces for n^k, and EV-MATH-0008 names POWER, the ^ operator and PERMUTATIONA together as subjects of the same finite-publication convention — while also recording that POWER and ^ carry an extra rule the others do not, mapping an infinity produced by a negative exponent over a sub-unit base to #DIV/0! instead of #NUM!. Whether PERMUTATIONA and POWER return the same bits for the same integer inputs is not established, and is a natural probe.
  • FACT, FACTDOUBLE and MULTINOMIAL are the neighbouring counting functions.

Named variants

No named variants are recorded yet.

Suggest a correction or contribute an implementation · For agents