RANK in Calligra Sheets: Rank Scores Ascending or Descending
Learn RANK(Value; Data; Order) in Calligra Sheets with a complete worksheet, descending and ascending examples, ties, missing-value checks and documented limits.
Verification status: Official documentation referenced; example outcomes independently reasoned or arithmetically checked where stated. Not executed in Calligra Sheets. How formula examples are checked
Quick answer
RANK returns the position of a specified numeric value within a comparison dataset, not the value at position k. With Order omitted or 0, the largest value ranks 1; with a nonzero Order, the smallest ranks 1. Official RANK description; KDE XML; 26.08.2 implementation, checked 2026-10-13.
=RANK(20;A2:A9)
In the dataset below, the independent expected result is 2, since only 30 exceeds 20. This is independently calculated from the eight entries; it is not native Calligra output.
Exact argument order, optional flag and important KDE documentation typo
=RANK(Value; Data; Order)
=RANK(Value; Data)
Value(required first): numeric score whose rank you want. It can reference a source cell such as A2 or contain a literal number.Data(required second): range/array containing the comparison numbers. The implementation enables array inputs. If the value is not found, the examined function returns an internalerrorNA().Order(optional third): if 0 or omitted, count from largest (descending); if nonzero, count from smallest (ascending). KDE registers two to three arguments. Use integer 0 or 1 rather than depending on conversion of decimal/text flags.- Return: numeric rank position, with equal values sharing the rank of their first position. A tie can create a gap in subsequent rank numbers (competition ranking).
Documentation discrepancy: the English rendered handbook incorrectly prints RSQ(Value; Data; Order) in the RANK subsection, although its surrounding description and example explicitly refer to RANK. KDE’s 26.08.2 official XML correctly specifies RANK(Value; Data; Order), and the source separately registers RANK with two or three arguments. This is a documentation typo, not evidence that RSQ is an alias for RANK. Do not enter the handbook’s erroneous RSQ(...) syntax for ranking. Rendered handbook; release-pinned XML; RANK registration.
Reproduce the worksheet before copying formulas
- Open a blank sheet in Calligra Sheets. Enter
Scorein A1. - Enter these eight numeric values, not quoted text, in the cells shown:
| Cell | A2 | A3 | A4 | A5 | A6 | A7 | A8 | A9 |
|---|---|---|---|---|---|---|---|---|
| Value | 12 | 7 | 20 | 7 | 15 | 30 | 12 | 4 |
- In an unused cell, type each formula below with the leading equals sign. For an ordinary English-language setup, use the semicolon argument separator documented by KDE. Press Enter to evaluate it in your own installed application.
- For independent cross-checking, ascending order is 4, 7, 7, 12, 12, 15, 20, 30; descending order is 30, 20, 15, 12, 12, 7, 7, 4. The two 7s and two 12s are intentional and make ties observable.
All results below are independently derived mathematical expectations, not screenshots or observed outputs from a running copy of Calligra. The examples avoid blanks and text because the pinned implementation’s array helper converts entries to floating point values instead of visibly skipping every non-numeric type. Do not extrapolate Excel’s text/blank rules to this Calligra source.
Nine independently checked ranking examples
| Formula | Mathematical expected result | Interpretation |
|---|---|---|
=RANK(30;A2:A9) |
1 | Largest is first, default descending |
=RANK(20;A2:A9) |
2 | Second-highest score |
=RANK(15;A2:A9;0) |
3 | Third-highest score |
=RANK(12;A2:A9) |
4 | Both 12s share fourth place |
=RANK(7;A2:A9) |
6 | Both 7s share sixth place |
=RANK(4;A2:A9) |
8 | Lowest is eighth descending |
=RANK(4;A2:A9;1) |
1 | Lowest is first ascending |
=RANK(7;A2:A9;1) |
2 | Both 7s share second ascending |
=RANK(20;A2:A9;1) |
7 | 20 is seventh ascending |
To cross-check without a program, count how many items are strictly greater than the target for descending rank, or strictly less for ascending rank, and add 1. This matches the examined function loop for a dataset of ordinary finite numbers whose queried value occurs in the input. For example, three values (30, 20, 15) exceed 12, giving descending rank 4. Likewise three values (4, 7, 7) are below 12, giving ascending rank 4. These counts derive from the specified dataset and implement the source comparison condition. RANK implementation.
Step-by-step ranking table and tie behavior
- Enter A2:A9 exactly as above. Put Descending rank in B1 and Ascending rank in C1.
- In B2 enter
=RANK(A2;$A$2:$A$9;0)and fill B2:B9. - In C2 enter
=RANK(A2;$A$2:$A$9;1)and fill C2:C9. The$prevents the comparison range from moving while A2 becomes A3, A4, and so on. - Compare with the independently calculated table:
| Row | Score (A) | Descending B | Ascending C |
|---|---|---|---|
| 2 | 12 | 4 | 4 |
| 3 | 7 | 6 | 2 |
| 4 | 20 | 2 | 7 |
| 5 | 7 | 6 | 2 |
| 6 | 15 | 3 | 6 |
| 7 | 30 | 1 | 8 |
| 8 | 12 | 4 | 4 |
| 9 | 4 | 8 | 1 |
Tie rule: the two scores of 12 both rank 4 descending, so rank 5 is skipped. The two scores of 7 both rank 6 descending, so rank 7 is skipped. For ascending order, 7 shares rank 2 and rank 3 is skipped; 12 shares rank 4 and rank 5 is skipped. The C++ code sorts the floating-point values and advances the count only past strictly smaller values (ascending) or strictly larger values (descending), which supports this inference for the clean numeric example. Source implementation.
Advanced applications and decisions
Leaderboard: Descending RANK is appropriate when higher is better; ascending RANK is appropriate for shorter elapsed times or lower costs. A rank does not identify which row uniquely owns the position when there is a tie.
Dynamic direction: Put 0 or 1 in E2 and use =RANK(A2;$A$2:$A$9;$E$2). A value of 0 ranks high-to-low; a value of 1 ranks low-to-high. The official C++ uses integer conversion for this optional argument. Changing E2 changes the same score’s ranking direction, not the underlying data.
Compare with order statistics: =LARGE(A2:A9;4) returns the value 12; =RANK(12;A2:A9) returns the position 4. In tie situations, the first calculation can return the same number at positions 4 and 5, while rank 5 never appears as an assigned rank for this dataset.
Important missing-value behavior: Although some spreadsheet users expect a hypothetical placement, the inspected C++ returns an internal errorNA() when the requested target is not found in the supplied data. For example, the value 13 is absent; avoid describing =RANK(13;A2:A9) as an interpolated placement. Exact application-visible error text is unverified. RANK source branch.
Troubleshooting, invalid inputs and uncertainty
| Issue | Evidence-based guidance |
|---|---|
=RSQ(12;A2:A9;0) copied from the RANK help syntax |
Handbook’s RANK syntax line has a typo; use RANK, not RSQ. The source registers separate functions |
| Rank direction is backwards | Omitted or 0 is descending; use 1 to rank lowest first |
| Two tied people have the same number | Expected competition ranking, not a unique row ordering |
| Target number is absent (for example, 13) | Inspected C++ reaches internal errorNA(); GUI spelling not native tested |
| Data contains blanks, text, TRUE/FALSE or errors | Source helper tries floating-point conversion; cannot establish exact runtime coercion without testing |
Order is text or non-integer |
Source converts to integer; use 0 or 1 to avoid unverified conversions |
| The range moves when formula is filled | Use $A$2:$A$9; KDE documents fixed references |
| Formula parser rejects commas | KDE’s English handbook uses semicolons, and syntax may depend on locale |
The function compares numeric doubles for exact equality after conversion. If a calculated target is only approximately equal to a rounded value in the dataset, a source-level possibility is that no exact match is found; test with displayed precision and source data instead of assuming equality. This is a source-based caution, not a verified GUI failure.
Dated, official claim-level references
- KDE RANK handbook — definition, order behavior, and the erroneous
RSQsyntax line; checked 2026-10-13. - KDE statistical.xml — correct function name, first/second/optional third parameter, worked
RANK (2;{1;2;3})example; checked 2026-10-13. - C++ registration — registered
RANK, 2–3 args, array support; checked 2026-10-13. - C++ rank body and array-conversion helper — default direction, integer conversion, duplicate ranking, absent-target error path; checked 2026-10-13.
- KDE formula-entry guide —
=, semicolon and absolute ranges; checked 2026-10-13. - KDE release announcement, KDE Sheets listing, Calligra download page — version and platform; checked 2026-10-13.
Version, platform, syntax and compatibility boundaries
This review is scoped to Calligra Sheets 26.08.2 from KDE Gear, officially dated 8 October 2026. The exact registered function and parameter counts were inspected in the KDE source at commit 72123cc643f6625351139e7df294544255a1056f and the official KDE XML function descriptions. KDE release notice; Calligra Sheets release listing; version-pinned function registry; XML descriptions. Registration and handbook presence demonstrate source/catalogue availability, not successful execution on a particular installed package.
KDE’s formulas guide says formulas begin with =; argument separators are semicolons in its examples; function names are case-insensitive; absolute references such as $A$2:$A$9 resist movement when filled. A locale or packaged build can behave differently: alternate decimal symbols, argument separators, language, and parsing were not tested. The review formulas use period decimals (where applicable), standard A1 references, and semicolons.
KDE’s download page documents Linux distribution installation and Flatpak and says Windows availability is still being worked on. Therefore Windows execution is not claimed. The Calligra source does not establish interoperability with Microsoft Excel, LibreOffice or Google Sheets, nor does it validate import/export of their workbooks. If transferring a workbook, re-test the formula, separators, sorting, ties and error cases in the target application rather than assuming identical results.
Related official references: LARGE, SMALL, RANK, MEDIAN, and COUNT all have official KDE function-reference entries.
Testing status
Official handbook/XML/C++ source inspected: YES, on 2026-10-13. Numerical results independently calculated: YES. Native Calligra worksheet execution: NOT PERFORMED. Visual/UI errors, locales, platform-specific packages, XLSX round-trips, screenshots: NOT TESTED.