fxExcelReps

← How-to guides

How to Extract the First Name in Excel

When names are written as First Last, the first name is everything before the first space: =LEFT(A2, FIND(" ", A2)-1). In Microsoft 365 the same is simply =TEXTBEFORE(A2, " "). Add TRIM first if the data has extra spaces.

{"cells": {"A1": "Full name", "A2": "Anna Petrova", "A3": "Ivan Georgiev", "A4": "Maria Ivanova Dimitrova", "A5": "Elena Stoyanova", "A8": "Surname, First", "A9": "Petrova, Anna", "B1": "First name", "B2": "=LEFT(A2,FIND(\" \",A2)-1)", "B3": "=LEFT(A3,FIND(\" \",A3)-1)", "B4": "=LEFT(A4,FIND(\" \",A4)-1)", "B5": "=LEFT(A5,FIND(\" \",A5)-1)", "B8": "First name", "B9": "=TRIM(MID(A9,FIND(\",\",A9)+1,99))", "C1": "With TEXTBEFORE", "C2": "=TEXTBEFORE(A2,\" \")", "C3": "=TEXTBEFORE(A3,\" \")", "C4": "=TEXTBEFORE(A4,\" \")", "C5": "=TEXTBEFORE(A5,\" \")"}, "focus": "B2", "note": "Type your own name in A2."}

LEFT and FIND (every version)

FIND gives the position of the space; LEFT takes everything before it.

=LEFT(A2, FIND(" ", A2)-1)Anna from "Anna Petrova".
=IFERROR(LEFT(A2, FIND(" ", A2)-1), A2)Returns the whole cell when there's no space.

TEXTBEFORE (Microsoft 365)

One readable function. The 6th argument is what to return if there's no space.

=TEXTBEFORE(A2, " ")Everything before the first space.
=TEXTBEFORE(TRIM(A2), " ", , , , A2)Safe for single names and extra spaces.

Surname, First name

Find the comma instead and take what comes after it.

=TRIM(MID(A2, FIND(",", A2)+1, 99))Anna from "Petrova, Anna".
=TEXTAFTER(A2, ", ")The same in Microsoft 365.

Common mistakes

#VALUE! error
The cell has no space, so FIND fails. Wrap the formula in IFERROR.
A space is left at the start
The data has leading spaces. Use TRIM(A2) inside the formula.

Frequently asked questions

How do I get the last name?

See extract the last name.

Can Excel do this without a formula?

Yes: type the first result by hand in the next column and press Ctrl+E (Flash Fill).

How do I capitalise the result?

Wrap it in PROPER: =PROPER(LEFT(A2, FIND(" ", A2)-1)).

Practise it

LEFTFINDTEXTBEFORE, TEXTAFTERTRIM

Think you know this?

15 formula tasks, no hints, with a leaderboard. Absolute, relative and mixed references included.

Take the Pro Challenge →

More how-to guides

How to Extract the Last Name in Excel

Get the last name or the last word from a full name in Excel with TEXTAFTER, or RIGHT, LEN and SUBSTITUTE in older versions.

How to Combine First and Last Name in Excel

Join first and last names in Excel with &, CONCAT or TEXTJOIN, with a space, a comma, or initials, and skip empty cells.

How to Split Text by a Delimiter in Excel

Split text at a comma, dash or space in Excel with TEXTBEFORE and TEXTAFTER, LEFT, MID and FIND, or Text to Columns.

How to Sum by Month in Excel

Total amounts by month in Excel from a list of dates, with SUMIFS and EOMONTH or SUMPRODUCT with MONTH. Live example included.