Compatibility

RANK

Matches all 6 recorded answers

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

Local names in 40 languages
LanguageName in Excel
ArabicRANK
BulgarianRANK
CzechRANK
DanishPLADS
GermanRANK
GreekRANK
English (Australia)RANK
English (United Kingdom)RANK
English (United States)RANK
SpanishJERARQUIA
EstonianRANK
FinnishARVON.MUKAAN
FrenchRANG
HebrewRANK
CroatianRANK
HungarianSORSZÁM
IndonesianRANK
ItalianRANK
JapaneseRANK
KoreanRANK
LithuanianRANK
LatvianRANK
NorwegianRANGERING
DutchPOSITIE
PolishPOZYCJA
Portuguese (Brazil)CLASSIFICAÇÃO
Portuguese (Portugal)ORDEM
RomanianRANK
RussianРАНГ
SlovakPORADIE
SlovenianRANK
Serbian (Latin)RANGIRANJE
SwedishRANG
ThaiRANK
TurkishRANK
UkrainianRANK
VietnameseRANK
Chinese (Simplified)RANK
Chinese (Hong Kong)RANK
Chinese (Traditional)RANK

Names from Microsoft's support site.

What it does

RANK(number, ref, [order])

RANK(number,ref,[order]) returns a number’s position within numeric observations. The default order is descending, so the largest value has rank one; a nonzero order requests ascending rank. It is the compatibility spelling of the tied-equal rank.

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.

With 30,20,20,10 in B2:B5, =RANK(20,B2:B5) returns 2. Both twenties have rank two and the ten has rank four: ties leave a gap.

Quirks

Text, logical values and blanks in the reference are ignored, while zeros and repeated numbers remain observations. Ties share their first occupied rank; they do not receive consecutive ranks or an average. A number absent from the admitted data gives #N/A in the current helper.

Microsoft describes any nonzero order as ascending. The current wrapper truncates its numeric order toward zero before testing it, so fractional flags between minus one and one select descending. That is an implementation rule, not a measured statement about every Excel build. A nonnumeric target is also #N/A in this wrapper; it is not automatically parsed from numeric-looking text.

How to implement

  1. Validate the target as the current wrapper does: preserve a numeric value or worksheet error; other target kinds give #N/A.
  2. Collect the reference’s numeric observations. Coerce and truncate a supplied order flag, then test zero versus nonzero.
  3. Confirm the target occurs. If it is absent, return #N/A.
  4. Descending rank is 1+count(value>target); ascending rank is 1+count(value<target). Equal observations contribute no preceding positions, so each member of a tie receives the same result.

With 30,20,20,10, only thirty exceeds twenty, giving rank two. All three other observations exceed ten, giving rank four. In ascending order thirty is fourth rather than first.

For a single query, counting avoids sorting and uses exact comparisons of the admitted numeric values. A sorted index can support many queries, provided it retains multiplicities and the same equality rule. Pairing this function with ROW-based tie breakers produces unique positions, which is a different ranking convention.

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.

RANK · 1 lines · calc-func/src/catalogue/statistics.rs on GitHub
11 rank_legacy "RANK" (2, 3) [V "number", F "ref", V "order"] |s, a, sv| { rank(s, a, sv, false) }

Kernels shared with other functions

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.

Alternatives

RANK.EQ makes this tie rule explicit; RANK.AVG averages tied positions; PERCENTRANK.INC returns fractional standing.

Named variants

No named variants are recorded yet.

Suggest a correction or contribute an implementation · For agents