How to extract the first name from a full name in Excel
Excel formula
=TEXTBEFORE(A2," ")In Excel 365 use =TEXTBEFORE(A2," "). In any version, =LEFT(A2,FIND(" ",A2)-1) takes everything before the first space.
- Result on the example
- one result per row in
B2, filled down toB7 - Works in
- Excel 2024 and Microsoft 365
- Google Sheets
- Different formula, see below
See it work
The formula is already in B2, filled down to B7. Change any input and the result updates, or edit the formula to experiment.
How it works
TEXTBEFORE returns the text before a delimiter, here the first space. The classic version finds the space with FIND and takes one character less than that position with LEFT.
The Google Sheets version uses LEFT and FIND, which work the same in every version of Excel too.
=TEXTBEFORE(A2," ")Result"Maria"
A2"Maria Lopez"The value in A2.
TEXTBEFORE(A2," ")"Maria"TEXTBEFORE: Text before a delimiter.- text
A2"Maria Lopez" - delimiter
" "
- text
In Google Sheets
Google Sheets needs a different formula: =LEFT(A2,FIND(" ",A2)-1). On the same data it gives the same result. Here it is running in Google Sheets mode.
Other ways to do it
Each one was run on the same example sheet.
| Formula | Result | When to use it |
|---|---|---|
| =LEFT(A2,FIND(" ",A2)-1) | Maria, James, Aiko… | Works in every version of Excel and in Google Sheets. |
| =LEFT(A2,SEARCH(" ",A2)-1) | Maria, James, Aiko… | SEARCH works the same here; it only matters for letters, since it ignores case. |
Common mistakes
- A name with no space returns #N/A from TEXTBEFORE (and #VALUE! from FIND). Add a fallback:
=TEXTBEFORE(A2," ",,,,A2)returns the whole name. - Leading spaces make the first "word" empty. Clean the column with TRIM first.
- Middle names: "Mary Ann Smith" gives "Mary". Whether that's right depends on your data.
Try it yourself
Same data, empty answer cell. Your formula is graded instantly, then re-checked on changed data, so a typed-in number won't pass.
Extract the first name from a full name
B2, extract the first name (everything before the first space) and fill down to B7.Questions
How do I get the last name?
Use the last space: =TEXTAFTER(A2," ",-1).
Is there a way without formulas?
Flash Fill (Ctrl+E) or Text to Columns can split names once, but they don't update when the names change.
Checked by running on 2026-10-29: every formula and result on this page was calculated by the Spreadsheet Practice formula engine, in both Excel and Google Sheets modes.