How to reverse a text string
✓ Verified in LibreOffice 25.8.7.3 Google Sheets returned something else (2026-08-30)Flip the characters in a cell end-to-end — "abc" becomes "cba" — for palindrome checks, obfuscation, or reversing codes.
The formula
| App | Formula | Notes |
|---|---|---|
| Excel (desktop) | =TEXTJOIN("",TRUE,MID(A2,SEQUENCE(LEN(A2),1,LEN(A2),-1),1)) | No built-in REVERSE. SEQUENCE counts positions down from the last, MID pulls each character, TEXTJOIN glues them. Excel 365 / LibreOffice 24.8+; older Excel needs Ctrl+Shift+Enter. |
| Google Sheets | =TEXTJOIN("",TRUE,ARRAYFORMULA(MID(A2,SEQUENCE(LEN(A2),1,LEN(A2),-1),1))) | Executed 2026-08-30: the unwrapped formula returned c in Google Sheets against cba in LibreOffice — only the first character came through, because Google Sheets does no implicit array evaluation inside a scalar function’s arguments. ARRAYFORMULA around the MID array is the documented fix. Documented Sheets syntax, carrying no executed result of its own. |
| LibreOffice Calc | =TEXTJOIN("",TRUE,MID(A2,SEQUENCE(LEN(A2),1,LEN(A2),-1),1)) | Needs 24.8+ for SEQUENCE. |
How it works
None of the three apps has a REVERSE function, so the trick is to read the characters back to front and rejoin them. SEQUENCE(LEN(A2),1,LEN(A2),-1) builds the position list from the last character down to the first — for "abc" that's {3;2;1}; MID(A2, that, 1) grabs one character at each position, giving {"c";"b";"a"}; and TEXTJOIN("",TRUE,...) concatenates them into "cba". It's a spilling array formula, so it needs dynamic arrays (Excel 365, LibreOffice 24.8+) — and in Google Sheets the ARRAYFORMULA wrapper shown above, because the plain version returned just "c" when we executed it there; on legacy Excel enter it with Ctrl+Shift+Enter and swap SEQUENCE for LEN(A2)-ROW(INDIRECT("1:"&LEN(A2)))+1. To reverse the ORDER OF ITEMS in a list rather than characters in a string, that's a different job — see reverse-the-order-of-a-list. A common use is testing for palindromes: compare A2 to its reverse with EXACT.
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.
| Formula | What it does | Returned by LibreOffice 25.8.7.3 | Returned by Google Sheets (executed 2026-08-30) |
|---|---|---|---|
=TEXTJOIN("",TRUE,ARRAYFORMULA(MID("abc",SEQUENCE(LEN("abc"),1,LEN("abc"),-1),1))) | ARRAYFORMULA around the MID array (over this page's literal "abc", where the general form uses A2) | n/a (Sheets-only formula) | cba 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 =TEXTJOIN("",TRUE,MID("abc",SEQUENCE(LEN("abc"),1,LEN("abc"),-1),1)) in LibreOffice 25.8.7.3 (headless, with forced recalculation) and it returned cba — 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 c, which is not what LibreOffice returned (cba) — 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
TEXTJOIN · MID · SEQUENCE · LEN · ARRAYFORMULA — see full Excel, Google Sheets & LibreOffice compatibility for each.
Related recipes
- How to extract numbers from text in a cell
- How to capitalize only the first letter (sentence case)
- How to extract the domain from an email address
- How to extract the last name from a full name
- How to remove text before a character