← All how-to recipes

How to remove everything after a character

✓ Verified in LibreOffice 25.8.7.3

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

The formula

AppFormulaNotes
Excel=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 24.8+ (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. Every formula here is confirmed by actually executing it.