← All how-to recipes

How to reverse the order of a list

✓ Verified in LibreOffice 25.8.7.3 Google Sheets returned something else (2026-08-30)

Flip a column so the last value comes first — without sorting alphabetically.

The formula

AppFormulaNotes
Excel (desktop)=SORTBY(A2:A4,ROW(A2:A4),-1)Excel 365/2021. Works for any values — it reverses position, not sort order.
Google Sheets=SORT(A2:A4,ROW(A2:A4),FALSE)Google Sheets has no SORTBY — executed 2026-08-30, =SORTBY(A2:A4,ROW(A2:A4),-1) returned #NAME? there against cherry, banana, apple in LibreOffice. Sheets’ own signature is SORT(range, sort_column, is_ascending), whose third argument is a boolean, so FALSE reverses the row numbers. Documented Sheets syntax, carrying no executed result of its own.
LibreOffice Calc=SORTBY(A2:A4,ROW(A2:A4),-1)Needs LibreOffice 24.8+.

How it works

SORTBY sorts one range by another: here the list is sorted by its own row numbers in descending order (-1), which simply flips it — cherry, banana, apple. Unlike SORT, this preserves the original arrangement in reverse rather than alphabetizing. In older versions without SORTBY, =INDEX($A$2:$A$4,COUNTA($A$2:$A$4)-ROWS($A$2:A2)+1) filled down does the same.

The Google Sheets alternative

Google Sheets needs different syntax for this task. The formula below is Sheets-specific — it was executed in Google Sheets (2026-08-30) against the same sample data as the worked example, and the value beside it is what Google returned. The LibreOffice column reads n/a because the formula is outside LibreOffice’s dialect, so there is nothing of ours to report there.

FormulaWhat it doesReturned by LibreOffice 25.8.7.3Returned by Google Sheets (executed 2026-08-30)
=SORT(A2:A4,ROW(A2:A4),FALSE)SORT on the row numbers with a boolean third argument — Google Sheets has no SORTBY n/a (Sheets-only formula) cherry, banana, apple Google Sheets alternative (executed 2026-08-30)
NOTE: written with the PLAIN function name; the LibreOffice reference run executed the _xlfn. storage form of this formula, so the two runs are not byte-identical inputs

Verified, not just documented

We ran =SORTBY(A2:A4,ROW(A2:A4),-1) in LibreOffice 25.8.7.3 (headless, with forced recalculation) and it returned cherry, banana, apple — exactly the expected result. We then ran the same formulas in Google Sheets, executed 2026-08-30: a formula-only workbook goes into Google Drive, which converts it to a Sheet and recalculates every formula with Google’s own engine, and comes back out as .xlsx carrying the values Google computed. For the worked example Google Sheets returned #NAME?, which is not what LibreOffice returned (cherry, banana, apple) — both values are shown as each engine produced them, and the disagreement itself is the finding. A further 1 row is a Google Sheets alternative: Sheets-specific syntax, executed in Google Sheets only, so the LibreOffice column reads n/a for it. Both engines’ numbers on this page are executed results. The Excel formula follows Microsoft’s official documented syntax — we do not run desktop Excel.

Functions used

SORTBY · ROW · SORT — see full Excel, Google Sheets & LibreOffice compatibility for each.

Related recipes