← All how-to recipes

How to remove everything after a character

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

Keep only the part of a cell before a dash, comma, @ or any delimiter.

The formula

AppFormulaNotes
Excel (desktop)=LEFT(A2,FIND("-",A2)-1)Excel 365: =TEXTBEFORE(A2,"-") is cleaner and handles missing delimiters with a 3rd argument.
Google Sheets=LEFT(A2,FIND("-",A2)-1)Identical; Sheets also has REGEXEXTRACT(A2,"^[^-]*").
LibreOffice Calc=LEFT(A2,FIND("-",A2)-1)Identical; TEXTBEFORE works in LibreOffice 25.8+ (#NAME? in 25.2 and older; with quirks — see its page).

How it works

FIND locates the first dash (position 4) and LEFT keeps everything before it: "ABC-123-XYZ" → "ABC". Note it cuts at the FIRST occurrence; to cut at the LAST one, use the text-after-last-delimiter trick in reverse, and to keep the part AFTER the character swap LEFT for MID. If some cells have no delimiter at all, FIND errors — wrap in IFERROR(...,A2) to pass those through unchanged.

Verified, not just documented

We ran =LEFT(A2,FIND("-",A2)-1) in LibreOffice 25.8.7.3 (headless, with forced recalculation) and it returned ABC — 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. It returned ABC for the worked example, the same value LibreOffice produced. 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

LEFT · FIND — see full Excel, Google Sheets & LibreOffice compatibility for each.

Related recipes

Related comparisons