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
=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.
Formula
Excel
Mathematical 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-ZAInputs 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-ZAInputs 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-ZAInputs 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-ZAInputs 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-ZAInputs 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-ZAInputs 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 fileInputs and reference value
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.
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.
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.