Contact

SORT Function in LibreOffice Calc — Tested Examples

Lookup Intermediate LibreOffice Calc

An explanation of LibreOffice Calc SORT, including tested formulas, examples, expected results and common mistakes.

Verification status: Selected examples were executed in LibreOffice Calc 25.2.3.2. This does not establish that every formula and edge case was tested. How formula examples are checked

Availability and version history

  • Introduced: LibreOffice 24.8.
  • Availability: Supported in LibreOffice 26.8.1.1, verified against its function registry. This identifies a supported release, not a final working version.
  • Scope: Desktop Calc, using the English function name. Availability in other spreadsheet applications is separate.
  • Checked: 2026-10-14 — function reference; versioned support. Documentation/source check; not a new native test. Existing example-specific test claims below retain their stated scope.

Sorts the contents of a range or array. In the example B1:B5 contains 10,20,30,40,50. Sorted descending, the first value is 50; sorted ascending, it is 10.

Syntax and arguments

=SORT(Range [; Sort_index [; Sort_order [; By_col]]])

Square brackets mark optional arguments; do not type the brackets. Separate arguments with semicolons (;).

Argument Explanation
Range Source range or array to sort.
Sort_index Optional position of the column or row used as the sort key.
Sort_order Optional: 1 sorts ascending; -1 sorts descending. Ascending is the default.
By_col Optional: FALSE sorts rows (default); TRUE sorts columns.

If a later optional field is supplied while an earlier one is omitted, keep the preceding separators. The official Help describes array-formula entry for SORT.

Official SORT syntax and arguments.

Worked examples

Reproduce these source cells: B1=10, B2=20, B3=30, B4=40, B5=50.

Full array output: FILTER, SORT and matrix functions may need a selected output range and Ctrl+Shift+Enter in LibreOffice Calc. The examples below return one scalar result that was tested directly.

Example 1: Find the highest value in a sorted descending result

=INDEX(SORT(B1:B5;1;-1);1)

Expected result: 50. This value was returned in the LibreOffice Calc 25.2 test.

Example 2: Get the smallest value from a sorted ascending array

=INDEX(SORT(B1:B5;1;1);1)

Expected result: 10. This value was returned in the LibreOffice Calc 25.2 test.

How to interpret the result

In the example B1:B5 contains 10,20,30,40,50. Sorted descending, the first value is 50; sorted ascending, it is 10.

Mistakes and troubleshooting

  • Check inputs and assumptions: To return the entire sorted array, use an appropriately sized formula output rather than a single-cell INDEX result.
  • Check argument order and format: Strings go in quotes, cell references do not. Functions that return arrays may require special entry.
  • Verify your own data: Reproduce the example first. If your formula returns an error, inspect the referenced cells and individual argument values.

FILTER · INDEX

Tested version and primary reference

This function is available since LibreOffice 24.8, according to the LibreOffice function documentation.

2 example(s) on this page passed real calculations in LibreOffice Calc 25.2.3.2. This is not a claim about every possible input or other spreadsheet applications.