← All how-to recipes

How to extract the last name from a full name

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

Pull just the last name out of a 'First Last' text string.

The formula

AppFormulaNotes
Excel (desktop)=MID(A2,FIND(" ",A2)+1,LEN(A2))Start one character after the space and take the rest.
Google Sheets=MID(A2,FIND(" ",A2)+1,LEN(A2))Identical. TEXTAFTER(A2," ") also works in newer versions.
LibreOffice Calc=MID(A2,FIND(" ",A2)+1,LEN(A2))Identical.

How it works

FIND(" ",A2)+1 is the position just after the first space; MID takes from there through the end of the string (LEN as a safe length). For 'Jane Doe' it returns 'Doe'. Note this returns everything after the first space, so 'Jane Van Doe' would give 'Van Doe'.

Verified, not just documented

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