Contact

SORT Function in ONLYOFFICE Spreadsheet Editor: Examples and Syntax

Lookup & Reference Beginner ONLYOFFICE Spreadsheet Editor

Sort vertical or horizontal data in ONLYOFFICE with SORT. Check ascending defaults, by_col direction and selected-output-range array entry using worked examples.

Verification status: See the evidence and test scope described in this guide. How formula examples are checked

Quick answer: Sort a two-column price list without changing source data. You want a price-sorted view of a catalog while leaving the original list untouched for editing.

This page covers the ONLYOFFICE Spreadsheet Editor implementation specifically. Its example values and expected results are original educational data, not screenshots or claims of a live application test.

Availability and version history

  • Introduced: The Desktop Editors changelog lists SORT under 7.4.0, released June 14, 2023. Other client-family introduction versions are not inferred.
  • Availability: Documented in the current ONLYOFFICE Spreadsheet Editor help; no final working-version endpoint is established.
  • Scope: Docs and Desktop Editors release separately. This unversioned help does not establish availability in every older build, mobile client or deployment.
  • Checked: October 23, 2026, against the official function reference and array-entry guide. These are English, comma-separated examples following the published keyboard workflow, not native tests on any operating system or client.

Syntax and argument order

=SORT(array, [sort_index], [sort_order], [by_col])

The official SORT reference defines:

Argument Meaning
array Input range or array
sort_index Optional column or row number to sort by
sort_order 1 or omitted: ascending; -1: descending
by_col FALSE or omitted: reorder rows of vertical data; TRUE: reorder columns of horizontal data

The reference does not specify the omitted sort_index value. These examples always supply it; do not import another spreadsheet application’s default.

Enter the complete output array

SORT is documented as an array formula. Follow ONLYOFFICE’s array-entry instructions:

  1. Select the entire empty result range, sized to the expected output.
  2. Type the formula in the formula bar.
  3. Confirm with Ctrl+Shift+Enter, not just Enter. ONLYOFFICE adds the array braces; do not type them yourself.

The guide says Enter alone returns one value for these functions. This page does not assume Excel-style automatic spilling from a single cell. The steps use the documented key combination; other platform-specific bindings are not established here.

Worked example with sample data

Row A: Item B: Price
2 Pens 8
3 Tape 3
4 Pencils 5
5 Envelopes 10

Select the empty D2:E5 result block, enter this formula in the formula bar and confirm with Ctrl+Shift+Enter:

=SORT(A2:B5,2,1)

Expected result: Tape 3; Pencils 5; Pens 8; Envelopes 10.

Why this result is correct: Column 2 of A2:B5 contains 8, 3, 5 and 10. Their ascending order is 3, 5, 8 and 10, with each item kept beside its price. Omitting by_col makes this a vertical sort. =SORT(A2:B5,2,1,FALSE) explicitly requests the same direction; =SORT(A2:B5,2) also omits the ascending sort_order. Use the same four-row, two-column output selection when trying either alternative.

Descending variation

Select a separate empty G2:H5 block and use the same array-entry procedure:

=SORT(A2:B5,2,-1)

Expected result: Envelopes 10; Pens 8; Pencils 5; Tape 3.

The negative sort order puts the most expensive items first.

Horizontal example: move columns, not rows

Enter this separate fixture in A8:E9. Column A contains row labels and is deliberately excluded from the sort input:

Row A B C D E
8 Item Pens Tape Pencils Envelopes
9 Price 8 3 5 10

Select empty B12:E13, a two-row, four-column output block, and enter with Ctrl+Shift+Enter:

=SORT(B8:E9,2,1,TRUE)

Expected result:

Row B C D E
12 Tape Pencils Pens Envelopes
13 3 5 8 10

Here sort_index=2 means the second row within B8:E9, which is worksheet row 9. With by_col=TRUE, each two-cell item/price column moves together. Using the vertical default would not request this left-to-right arrangement.

Common mistakes and troubleshooting

Only one value appears: Check the selected output size and array-entry confirmation. For the vertical example it must be 4 × 2; for the horizontal example it must be 2 × 4. Do not treat a one-cell result as a successful full-array check.

The wrong field determines the order: Count the key position inside array, not across the worksheet. Check by_col before changing sort_index.

Prices sort unexpectedly: Inspect whether they are numbers with ISNUMBER. Changing number formatting alone is not evidence that imported text became numeric; repair a copy of the input and retry the small fixture.

You need to edit or grow the output: The array guide requires Ctrl+Shift+Enter when editing and describes selecting the existing array plus the additional result cells before expanding it. Do not edit or delete one cell from a multi-cell array. Recheck both the input and output dimensions.

Also check that the version of ONLYOFFICE Spreadsheet Editor you use supports this function. A formula pasted from another application can fail because of different syntax, date interpretation, array behavior or regional separators. If the result differs, first compare the small dataset above with the expected answer before substituting your real data.

Where this function helps

You want a price-sorted view of a catalog while leaving the original list untouched for editing. Replacing the sample cells with your own ranges lets you reuse the same reasoning. On important spreadsheets, test with a few known rows, verify the final cell formatting and keep a separate copy of the source data.

Practical checks before reusing this formula

SORT can create an output array while leaving the source unsorted. This is different from sorting source rows in place using a spreadsheet menu command.

When sorting a multi-column range, ensure the selected sort column belongs to that range. Test records with repeated keys to see whether tie order matters.

To compare this function with other spreadsheet programs, use our spreadsheet function comparison. A missing guide does not mean a function is unsupported in another product; check its official documentation.

Official reference and verification

  • Official ONLYOFFICE Spreadsheet Editor — SORT reference
  • Official array-formula entry and editing guide
  • Verification status: Official documentation checked October 23, 2026. A separate script checked ascending/descending record order, horizontal column pairing and output dimensions. These are independent data-model checks, not execution of the SORT engine or keyboard workflow. Not executed in ONLYOFFICE Spreadsheet Editor.
  • No genuine ONLYOFFICE Spreadsheet Editor screenshots are included; this guide does not use mock application images.