Compatibility

MODE

Matches all 24 recorded answers

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

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

Names from Microsoft's support site.

What it does

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

MODE(number1,[number2],...) returns one value with the highest repetition count. This is the compatibility function; MODE.SNGL is the explicit single-result name. It finds a repeated value, not a middle value or an average.

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.

=MODE({5,2,5,7}) returns 5, which occurs twice. The result is one of the observations, not their average.

Quirks

The recorded collection rule takes numbers only, including when text or logicals are typed directly. It skips numeric-looking text and TRUE rather than converting them. Thus MODE("2",2) and MODE(TRUE,1) have only one admitted number and give #N/A; MODE("x",2,2) still returns two.

A data set without any repeated number gives #N/A. Numeric zero participates. Error values propagate, with the first recorded error winning; arbitrary text is skipped rather than turned into a conversion error. A tied data set can have several modes although this function returns one.

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

Collect numeric values only from direct arguments and held collections; skip text and logical values, and propagate errors. Normalize positive and negative zero as one key, and count occurrences. Track each key’s first occurrence. Find the largest count; if it is below two, return #N/A. Return a key attaining that count. The current code orders tied modes by first appearance and uses that order for the single-result choice. That is the implementation’s tie policy, not a whole-domain identification from the public function page. Keep the tie case in compatibility tests.

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 · 6 lines · calc-func/src/catalogue/statistics.rs on GitHub
6 mode "MODE" (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 same-input comparison between named Excel builds is recorded for this function here. The documented behaviour below is not a measurement of every Excel release.

Excel 16.0.20527.20088

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

=MODE("2",2) returned #N/A. =MODE(TRUE,1) returned #N/A. 2 further recorded controls are attached. 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("2",2) → #N/A (formula-literal)
  • =MODE(TRUE,1) → #N/A (formula-literal)
  • =MODE("x",2,2) → 2
    0x4000000000000000 (formula-literal)
  • =MODE("x") → #N/A (formula-literal)

Excel 16.0.20527.20088

Windows, bitness and CPU not recorded in this reading file

MODE(2, 2, A3) returned #DIV/0!. Inputs were supplied through cells using Value2. These are controls from this environment, not a same-input comparison with another build.

Observed formulas and results
  • MODE(2, 2, A3) → #DIV/0! (cell-value2)

Alternatives

MODE.SNGL returns a single mode; MODE.MULT returns tied modes; MEDIAN measures a different kind of centre.

Named variants

No named variants are recorded yet.

Suggest a correction or contribute an implementation · For agents