Split names and take text before a character

Text and cleaning · About 6 minutes

Split names and take text before a character

Names and emails come in different lengths, so =LEFT(A2,7) only works for one row. FIND tells you where the break is, and LEFT or MID cut there.

=LEFT(A2,FIND(" ",A2)-1) reads as "take everything in A2 up to the character before the space". That's the first name. The -1 leaves the space itself out.

For the part after the break, start one character past it: =MID(A2,FIND(" ",A2)+1,LEN(A2)). The last part only needs to be big enough, and the whole length of A2 always is.

Part of Plus

Free during our founding launch: sign in to unlock this lesson's exercises, the timed practice sets and the rest of Plus. The free lessons stay free, with no account needed.

What Split text with LEFT, MID and FIND does

To split a full name into first and last name, or take the text before a character, you combine FIND with LEFT or MID. FIND gives the position of the break, like the space in a name or the @ in an email. LEFT or MID then cut the text at that spot.

Because FIND works out the position on each row, the same formula works for short and long names alike. You write it once and fill it down, instead of counting characters row by row.

How to write Split text with LEFT, MID and FIND

=LEFT(text, FIND(find_text, text) - 1)

text
The cell to split, like A2, used twice: once to cut and once to search.
FIND(find_text, text)
The position of the break character, like a comma or a space.
- 1
Stops one character before the break, so the break itself is left out.

=MID(text, FIND(find_text, text) + 1, LEN(text))

FIND(find_text, text) + 1
Starts one character after the break, for the part that follows it.
LEN(text)
How many characters to take. The whole length of the cell is always enough to reach the end.

Split text with LEFT, MID and FIND worked example

Each place is written city, then state. In B2, take the city: the text before the comma in A2. Then fill down to B5.

Each place is written city, then state. In B2, take the city: the text before the comma in A2. Then fill down to B5.
AB
1PlaceCity
2Austin, TXAustin
3Denver, CODenver
4Salt Lake, UTSalt Lake
5Boston, MABoston
B2=LEFT(A2,FIND(",",A2)-1)Find the comma in A2, at character 7, and take the 6 characters before it: the first row shows Austin. Filled down, the column shows Austin, Denver, Salt Lake and Boston.

Common Split text with LEFT, MID and FIND mistakes

The first name ends with a space

Without the -1, LEFT takes the break character too. Subtract 1 from the FIND result so the cut stops just before the space or comma.

The last part starts with a space

When the parts are split by a comma and a space, the second part starts two characters past the comma. Use +2 in MID, or wrap the result in TRIM.

A row with no break shows #VALUE!

FIND finds nothing in a one-word name, so the formula has no position to use. Wrap it in IFERROR and show the whole cell for those rows.

A formula, or split to columns?

Use the LEFT, MID and FIND formula when the list keeps growing or changing, because the split updates by itself. For a one-off split, the Text to Columns tool in Excel, or Split text to columns in Google Sheets, is quicker.

Microsoft 365 also has TEXTBEFORE and TEXTAFTER, which do this in one step, and Google Sheets has SPLIT. The FIND formula works in every version of both.

Questions people ask

How do I get the first name from a full name?

=LEFT(A2,FIND(" ",A2)-1) takes everything before the space. The -1 leaves the space out.

How do I get the text after a character?

Start one past it: =MID(A2,FIND(" ",A2)+1,LEN(A2)).

How do I take the text before the @ in an email?

=LEFT(A2,FIND("@",A2)-1).

Is there a shorter way in Excel 365?

TEXTBEFORE and TEXTAFTER do this in Microsoft 365 and Excel 2024 only. Google Sheets doesn't have them. LEFT, MID and FIND work in every version and in Google Sheets.

Theme