# Difference between revisions of "Documentation/How Tos/Calc: RANK function"

From Apache OpenOffice Wiki

< Documentation | How Tos

OOoWikiBot (Talk | contribs) m (Robot: Automated text replacement %s) |
m |
||

Line 36: | Line 36: | ||

* [[Documentation/How_Tos/Calc: Functions listed alphabetically|Functions listed alphabetically]] | * [[Documentation/How_Tos/Calc: Functions listed alphabetically|Functions listed alphabetically]] | ||

* [[Documentation/How_Tos/Calc: Functions listed by category|Functions listed by category]]}} | * [[Documentation/How_Tos/Calc: Functions listed by category|Functions listed by category]]}} | ||

− | [[Category: Documentation/Reference/Calc]] | + | [[Category: Documentation/Reference/Calc/Statistical functions]] |

## Revision as of 12:52, 17 May 2010

## RANK

Returns the rank of a number in a list of numbers.

### Syntax:

**RANK(number; numberlist; order)**

- returns the rank of
within the unordered range or array of numbers**number**.**numberlist**

- If
is zero or omitted, numbers are ranked with the highest being first; if**order**is non-zero, numbers are ranked with the lowest being first.**order**

- An error results if
is not present in**number**.**numberlist**

### Example:

**RANK(5; B1:B4)**

- where cells
,**B1**,**B2**,**B3**contain**B4**,**4**,**7**,and**5**, returns**8**. The highest number is**3**, then**8**, then in third place**7**.**5**

**RANK(5; {3;5|2.6;1}; 1)**

- returns
, as the other three numbers are lower than**4**.**5**

### Issues:

- By design,
returns the same rank for any value that is repeated in**RANK**. If you wish a unique rank for each number in (say)**numberlist**, enter**A1:A4**in cell**=RANK(A1;$A$1:$A$4)+COUNTIF($A$1:A1;A1)-1**and copy/paste into**B1**.**B2:B4** - Calc assumes that any logical values are
(**1**) and**TRUE**(**0**). Excel's behaviour with logical values may be 'unexpected'.**FALSE**