How to Separate Last Name in Excel

If you just need to separate last name in excel and move on, the boxed answer at the top is all you need. The rest of this page is for when you want to understand why it works in Excel, adapt it to a trickier version, or make it robust enough to hand to a colleague. We keep the opening short on purpose — the depth is here when you want it, not in your way when you don’t.

Exact answer

In Excel: select the column and use Data ▸ Text to Columns ▸ Delimited ▸ Space — or in Microsoft 365, =TEXTBEFORE(A2," ") for the first name and =TEXTAFTER(A2," ",-1) for the last. Function availability: TEXTBEFORE: Excel 2024+. These are Microsoft's version markers; earlier perpetual releases do not include these functions. Check the actual product and update channel before using the formula. A marker does not establish an identical Web/Mac workflow or Google Sheets support.

On this page7
▤Annotated stepsExcel
1

Function availability: TEXTBEFORE: Excel 2024+. These are Microsoft's version markers; earlier perpetual releases do not include these functions. Check the actual product and update channel before using the formula. A marker does not establish an identical Web/Mac workflow or Google Sheets support.

2

Insert enough empty columns to the right first — a split overwrites whatever is there.

3

Microsoft 365: =TEXTBEFORE(A2," ") for the first name, =TEXTAFTER(A2," ",-1) for the last.

4

Excel 2019 or earlier: =LEFT(A2,FIND(" ",A2)-1) and =TRIM(RIGHT(SUBSTITUTE(A2," ",REPT(" ",99)),99)).

5

For a one-off, consistent list, type the first result by hand and press Ctrl+E for Flash Fill.

6

Data ▸ Text to Columns ▸ Delimited ▸ Space works only when every name has exactly two parts.

7

Scan the result for particles (van, de, del, von) and hyphenated surnames, which no delimiter rule gets right on its own.

8

Copy the results and Paste Special ▸ Values before deleting the original column.

=TEXTBEFORE(A2," ")
Ctrl+CthenCtrl+Shift+V⌘+Cthen⌘+Ctrl+VPaste values · WindowsMac

What this does

Names are the hardest thing to split on a delimiter, because the delimiter count varies: "Ada Lovelace" has one space, "Ada King Lovelace" has two, "van der Berg" has particles that belong to the surname, and "Lovelace, Ada" is reversed. Text to Columns splits on every space blindly, which puts middle names in the wrong column. The robust approach takes the first token from the left and the last from the right, letting anything between fall into a middle column: TEXTBEFORE/TEXTAFTER in Microsoft 365, or LEFT/FIND and RIGHT/LEN/SUBSTITUTE in older versions. Flash Fill (Ctrl+E) handles a consistent list in one keystroke and should be checked, not trusted. Keep the inputs visible and clearly labelled and the whole thing stays auditable — anyone who opens the file later, including you, can see at a glance exactly what feeds the result and change one assumption without hunting through the formula. Treat “separate last name in excel” as a small repeatable workflow rather than a one-off click you hope to remember next time. Use a small test block before the live file, so any surprise in the affected cells shows up while it is still harmless. When a formula is involved, keep the inputs labelled beside it, reference cells instead of typing values, and apply number formatting only after the result checks out. That turns a text operation that turns messy entries into clean, usable data into a method you can reuse, explain, and defend when the workbook leaves your screen.

A worked example

A2 holds "Ada King Lovelace". First name: =TEXTBEFORE(A2," ") returns Ada. Last name: =TEXTAFTER(A2," ",-1) — the -1 means the LAST space — returns Lovelace. Middle: =TRIM(SUBSTITUTE(SUBSTITUTE(A2,B2,""),D2,"")) returns King. In Excel 2019 and earlier: first name =LEFT(A2,FIND(" ",A2)-1); last name =TRIM(RIGHT(SUBSTITUTE(A2," ",REPT(" ",99)),99)). For "Lovelace, Ada" swap the order: last =TEXTBEFORE(A2,","), first =TRIM(TEXTAFTER(A2,",")). Contact exports, sign-up lists and CRM dumps all arrive with one name column, and mail merges, sorting by surname and de-duplication all need it split — correctly enough that "van der Berg" survives. Check the referenced cells, argument order and result type in your workbook. Start with the worked example before changing an input, then compare the changed result with the calculation you expected. An error value or a result of a different type is a reason to inspect the inputs and arguments.

In Google Sheets

Function availability: TEXTBEFORE: Excel 2024+. These are Microsoft's version markers; earlier perpetual releases do not include these functions. Check the actual product and update channel before using the formula. A marker does not establish an identical Web/Mac workflow or Google Sheets support. Keep this page bookmarked for the next time the same question comes up. Better still, repeat the steps once in your own workbook — doing it yourself is what turns a copied answer into something you remember. For “separate last name in excel”, keep the input cells and the result visible while you check the formula in Excel. Follow the worked example and change one input at a time. The steps explain the workbook calculation; this page does not run a live calculator for that task.

Common mistakes

  • Using Text to Columns on a list containing middle names, which shifts the surname into a third column for some rows only.
  • Deleting the source column while the split columns are still formulas pointing at it.
  • Trusting Flash Fill without checking — it infers from the first rows and silently mishandles the exceptions.
  • Splitting "Last, First" data with a space rule, which puts the comma on the surname.
  • Assuming every row has a last name; single-word entries break RIGHT-based formulas without an IF guard.

Frequently asked questions

How do I separate first and last name in Excel?

Data ▸ Text to Columns ▸ Delimited ▸ Space for simple two-part names. For anything with middle names, use =TEXTBEFORE(A2," ") and =TEXTAFTER(A2," ",-1) in Microsoft 365.

What if some names have a middle name?

Take the first token from the left and the last from the right, and let everything between fall into a middle column. Splitting on every space is what puts surnames in the wrong place.

How do I handle "Lastname, Firstname"?

Split on the comma instead: =TEXTBEFORE(A2,",") is the surname and =TRIM(TEXTAFTER(A2,",")) is the first name.

Does Flash Fill work for names?

Often, with Ctrl+E after typing one example. It infers a pattern from the first rows, so check the exceptions — particles like "van der" and hyphenated surnames are where it goes wrong.

Which Excel release does this formula require?

Function availability: TEXTBEFORE: Excel 2024+. These are Microsoft's version markers; earlier perpetual releases do not include these functions. Check the actual product and update channel before using the formula. A marker does not establish an identical Web/Mac workflow or Google Sheets support.