← All how-to recipes

How to remove text before a character

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

Strip everything up to and including a marker — keep just the part after the colon, the last segment after a slash, the value after an equals sign.

The formula

AppFormulaNotes
Excel (desktop)=MID(A2,FIND(":",A2)+1,LEN(A2))FIND locates the marker; MID returns from just after it to the end. Excel 365 / Sheets: =TEXTAFTER(A2,":") is cleaner. Change ":" to your delimiter.
Google Sheets=MID(A2,FIND(":",A2)+1,LEN(A2))Identical. =TEXTAFTER(A2,":") or =REGEXEXTRACT(A2,":(.*)") also work.
LibreOffice Calc=MID(A2,FIND(":",A2)+1,LEN(A2))Identical; TEXTAFTER needs LibreOffice 25.8+ (#NAME? in 25.2 and older).

How it works

FIND returns the position of the marker, so FIND(":",A2)+1 is the first character AFTER it; MID then grabs from there to the end (passing LEN(A2) as the length just means 'take everything left'). For "code:1234" the colon is at position 5, so MID starts at 6 and returns "1234". Use SEARCH instead of FIND if you want case-insensitive matching or wildcards. This finds the FIRST occurrence — to cut after the LAST one (handy for file paths), the modern one-liner is TEXTAFTER(A2,"/",-1), or the classic trick swaps the last delimiter for a marker first. If the character might be missing, FIND errors with #VALUE!, so wrap in IFERROR(...,A2) to leave such rows untouched.

Verified, not just documented

We ran =MID("code:1234",FIND(":","code:1234")+1,LEN("code:1234")) in LibreOffice 25.8.7.3 (headless, with forced recalculation) and it returned 1234 — 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 1234 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

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

Related recipes

Related comparisons