← All how-to recipes

How to get the text after the last delimiter (e.g. a file extension)

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

Return everything after the final separator, like the extension after the last dot.

The formula

AppFormulaNotes
Excel=TEXTAFTER(A2,".",-1)Excel 365; -1 means the last occurrence.
Google Sheets=REGEXEXTRACT(A2,"[^.]+$")Google Sheets has no TEXTAFTER โ€” executed 2026-08-30, =TEXTAFTER(A2,".",-1) returned #NAME? there against xlsx in LibreOffice. REGEXEXTRACT with [^.]+$ takes everything after the last dot; =INDEX(SPLIT(A2,"."),1,COUNTA(SPLIT(A2,"."))) is the SPLIT-based equivalent. Both are documented Sheets syntax, carrying no executed result of their own.
LibreOffice Calc=TEXTAFTER(A2,".",-1)LibreOffice 25.8 supports TEXTAFTER.

How it works

TEXTAFTER(text, delimiter, -1) returns everything after the LAST occurrence of the delimiter. For 'report.final.xlsx' that is 'xlsx'. The negative instance number counts from the end.

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)
=REGEXEXTRACT(A2,"[^.]+$")REGEXEXTRACT with [^.]+$ takes everything after the last dot โ€” Google Sheets has no TEXTAFTER n/a (Sheets-only formula) xlsx Google Sheets alternative (executed 2026-08-30)

Verified, not just documented

We ran =TEXTAFTER(A2,".",-1) in LibreOffice 25.8.7.3 (headless, with forced recalculation) and it returned xlsx — 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 (xlsx) — 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 Excel.

Functions used

TEXTAFTER · REGEXEXTRACT — see full Excel, Google Sheets & LibreOffice compatibility for each.

Related comparisons