Statistical functions

MODE.SNGL

Matches all 22 recorded answers

Recorded: 22 workbook cells. How we measure this · See the Rust code

Local names in 40 languages
LanguageName in Excel
ArabicMODE.SNGL
BulgarianMODE.SNGL
CzechMODE.SNGL
DanishHYPPIGST.ENKELT
GermanMODE.SNGL
GreekMODE.SNGL
English (Australia)MODE.SNGL
English (United Kingdom)MODE.SNGL
English (United States)MODE.SNGL
SpanishMODA.UNO
EstonianMODE.SNGL
FinnishMOODI.YKSI
FrenchMODE.SIMPLE
HebrewMODE.SNGL
CroatianMODE.SNGL
HungarianMÓDUSZ.EGY
IndonesianMODE.SNGL
ItalianMODE.SNGL
JapaneseMODE.SNGL
KoreanMODE.SNGL
LithuanianMODE.SNGL
LatvianMODE.SNGL
NorwegianMODE.SNGL
DutchMODUS.ENKELV
PolishWYST.NAJCZĘŚCIEJ.WART
Portuguese (Brazil)MODE.SNGL
Portuguese (Portugal)MODO.SIMPLES
RomanianMODE.SNGL
RussianМОДА.ОДН
SlovakMODE.SNGL
SlovenianMODE.SNGL
Serbian (Latin)MODE.SNGL
SwedishTYPVÄRDE.ETT
ThaiMODE.SNGL
TurkishENÇOK_OLAN.TEK
UkrainianMODE.SNGL
VietnameseMODE.SNGL
Chinese (Simplified)MODE.SNGL
Chinese (Hong Kong)MODE.SNGL
Chinese (Traditional)MODE.SNGL

Names from Microsoft's support site.

What it does

MODE.SNGL(number1, [number2], ...)

MODE.SNGL(number1, [number2], …) returns a most frequently occurring value in the data.

Write the admitted values as a multiset S over the reals, and let m(v) be the multiplicity of v in S. Define

M = max { m(v) : v in S }
A = { v in S : m(v) = M }        the set of modes

Then:

  • if M = 1 — every value occurs once — the mode is not defined and the function reports #N/A;
  • if M > 1 and |A| = 1, the answer is the unique element of A;
  • if M > 1 and |A| > 1, the mathematics does not pick a winner and the function must.

That third line is the whole substance of this page. The mode is the one classical measure of central tendency that is not a function of the data in the ordinary sense: it is set-valued. MEDIAN resolves its even-n ambiguity by a stated rule (average the two middle values). MODE.SNGL resolves a genuine multiplicity of maxima by an unstated one, and the selection rule is the fact a reader most needs and is least likely to find written down.

The mode is also not a statistic of the underlying distribution in any stable sense. For a continuous population the sample mode is almost surely #N/A (no value repeats), and where it is not, it is an artefact of rounding or of a measurement grid rather than of the distribution. MODE.SNGL is a function about the recorded data, not about the process that produced it.

Arguments

ArgumentMeaningDefault
number1The first argument: a number, a reference, an array, or a name. Required.—
number2, …Further arguments of the same kinds. Optional, repeating.—

Which values reach the multiset is not the usual worksheet asymmetry: the function takes only numbers from its arguments, even when text or a logical is typed directly into the call (FN-MODE-001). See Coercion and lifting, which states the usual asymmetry once and explains why there is deliberately no global precedence rule.

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.

  • No repeated value. The documented result is #N/A. This is the common case for measured data and it is not an error in the sense of a mistake; it is the correct report that the sample has no mode.
  • Ties among several modes. The selection rule is not stated on Microsoft's page and this Handbook does not know it. The two natural candidates are smallest tied value and first tied value in argument order, and they are distinguishable with a two-argument probe. See the probe list below.
  • Arrays. MODE.SNGL is an aggregate, not a lift kernel: an array argument is consumed by scanning, and the function returns a scalar.

Errors

ErrorCondition
#N/AThe data set contains no value that occurs more than once
propagatedAn error value among the admitted values surfaces as that error; of two errors the first is returned

The #N/A row is documented by Microsoft on the page cited in Sources. Retrieval of that page was refused by the upstream host while this page was written, so the row is published as documented behaviour with its source named and should be re-checked against the page. The propagation row is measured. There is no #VALUE! row: a direct argument that does not convert to a number is ignored, so MODE.SNGL("x",2,2) is 2 (FN-MODE-001).

MODE ignores direct text and logicals instead of converting them or giving an error

MODE, MODE.SNGL and MODE.MULT take only numbers from their arguments, even when text or a logical is typed directly into the call. A direct "2" or TRUE is not converted, so MODE("2",2) and MODE(TRUE,1) are #N/A: one number, no repeat. Text that is not a number gives no error either: MODE("x",2,2) is 2, and MODE("x") is #N/A. Error values do come through: MODE(2,2,A3) with #DIV/0! in A3 is #DIV/0!, and of two errors the first is returned.

FormulaExcelMathematical value
=MODE("2",2)
Excel 16.0.20527.20088 Current Channel, Windows 64-bit (NT 10.0.26200), x86-64, AMD Ryzen 7 4800H, en-ZA
Inputs and reference value

Typed formula.

#N/A—
=MODE(TRUE,1)
Excel 16.0.20527.20088 Current Channel, Windows 64-bit (NT 10.0.26200), x86-64, AMD Ryzen 7 4800H, en-ZA
Inputs and reference value

Typed formula.

#N/A—
=MODE("x",2,2)
Excel 16.0.20527.20088 Current Channel, Windows 64-bit (NT 10.0.26200), x86-64, AMD Ryzen 7 4800H, en-ZA
Inputs and reference value

Typed formula.

2
0x4000000000000000
—
=MODE("x")
Excel 16.0.20527.20088 Current Channel, Windows 64-bit (NT 10.0.26200), x86-64, AMD Ryzen 7 4800H, en-ZA
Inputs and reference value

Typed formula.

#N/A—
=MODE.SNGL("x",2,2)
Excel 16.0.20527.20088 Current Channel, Windows 64-bit (NT 10.0.26200), x86-64, AMD Ryzen 7 4800H, en-ZA
Inputs and reference value

Typed formula.

2
0x4000000000000000
—
=MODE.MULT("x",2,2)
Excel 16.0.20527.20088 Current Channel, Windows 64-bit (NT 10.0.26200), x86-64, AMD Ryzen 7 4800H, en-ZA
Inputs and reference value

Typed formula.

2
0x4000000000000000
—
MODE(2, 2, A3)
Excel 16.0.20527.20088, Windows, bitness and CPU not recorded in this reading file
Inputs and reference value

Number supplied through a cell.

number1: 2
0x4000000000000000

number2: 2
0x4000000000000000

number3: #DIV/0!

#DIV/0!—

Inputs, build details and evidence

How to implement

Numerical notes

There is no floating-point approximation here — no series, no argument reduction, no cancellation. Everything difficult about MODE.SNGL is discrete.

  1. The equality predicate is the algorithm's only real decision. Multiplicity counting is parameterized by "same value", and a tolerant comparison is not an equivalence relation on the reals: if a ≈ b and b ≈ c under a fixed absolute-or-relative tolerance, a ≈ c can fail. An implementation that groups by a tolerant predicate therefore has to define what a group is — chaining, or clustering around a representative — and different definitions give different multiplicities on the same data. An implementation that groups by exact bits has no such problem and a different one: values that a user regards as equal are counted apart.
  2. The tie-break falls out of the data structure, not out of a decision. A sort-then-scan implementation naturally reports the smallest tied value; a hash-map implementation reports whichever key the iteration order surfaces; a first-pass-wins scan reports the earliest in argument order. All three are O(n log n) or better and all three are defensible, and they disagree. This is the classic case where an implementation detail becomes an observable semantic, and the only correct response is to pin the rule deliberately and test it.
  3. -0.0 and 0.0 compare equal under IEEE 754 == but have different bit patterns. A bitwise grouping separates them; a numeric grouping does not. The same question arises for values arriving from different cells with different formats.
  4. Stability under argument regrouping. MODE.SNGL(A, B) and MODE.SNGL(B, A) should agree; under a first-encountered tie-break they need not. That is a cheap invariant to test and a cheap one to get wrong.

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.

MODE.SNGL · 6 lines · calc-func/src/catalogue/statistics.rs on GitHub
7 mode_sngl "MODE.SNGL" (1, 255) [R "number1", R "number2"] |s, a, sv| {
    match modes(&all(s, a, sv, Held::ModeNumbers)?).first() {
        Some(m) => s.number(*m),
        None => fail(WorksheetErrorCode::NA),
    }
}

Kernels shared with other functions

  • all catalogue/statistics
  • modes catalogue/statistics

Argument and result plumbing

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

Version differences

No comparison between specific Excel builds is recorded here yet. This does not establish that all builds behave alike.

Excel 16.0.20527.20088

Windows 64-bit (NT 10.0.26200), x86-64, AMD Ryzen 7 4800H, en-ZA

=MODE.SNGL("x",2,2) returned 2 (0x4000000000000000). Inputs were supplied through formula literals. These are controls from this environment, not a same-input comparison with another build.

Observed formulas and results
  • =MODE.SNGL("x",2,2) → 2
    0x4000000000000000 (formula-literal)

Alternatives

Relationships

  • MODE.MULT is the honest sibling: it returns the whole set A as a vertical array, which is what the mathematics actually produces. Where MODE.SNGL hides a tie, MODE.MULT exposes it. If you care whether your data has one mode or several, that is the function to use, and COUNT(MODE.MULT(…)) is the direct test.
  • MEDIAN and AVERAGE are the other two classical centres. Only MODE.SNGL can fail to exist; only MODE.SNGL is unchanged by an arbitrary monotone relabelling of the values; only AVERAGE uses every observation.
  • Confused with: MAX (largest value, not most frequent) and COUNTIF (how many times a given value occurs, which is m(v) for one v rather than the argmax over v).

Named variants

No named variants are recorded yet.

Suggest a correction or contribute an implementation · For agents