How can I extract the first word from a cell in excel?


You can use the following formula to extract the first word from a cell in Excel:

=IFERROR(TEXTBEFORE(A2, " "), A2)

This particular formula extracts the first word from cell A2.

The following example shows how to use this formula in practice.

Example: How to Extract First Word in Excel

Suppose we have the following column of strings in Excel:

Suppose we would like to extract the first word from each cell in column A.

We can type the following formula into cell B2 to do so:

=IFERROR(TEXTBEFORE(A2, " "), A2)

We can then click and drag this formula down to each remaining cell in column B:

Excel extract first word from cell

Column B now contains the first word from each corresponding cell in column A.

For example:

  • The formula extracts My from My favorite animal is a manatee
  • The formula extracts This from This is a great day
  • The formula extracts We from We should have fun

And so on.

How This Formula Works

This function uses the following syntax:

TEXTBEFORE(text, delimiter, [instance_num], [match_mode], [match_end], [if_not_found])

where:

  • text: Text to search
  • delimiter: Character or substring to extract text before
  • instance_num (optional): Instance of delimiter before which to extract text (default is 1)
  • match_mode (optional): 0 = case-sensitive (default), 1 = case-insensitive
  • match_end (optional): Treat end of text as delimiter (disabled by default)
  • if_not_found (optional): Value to return if delimiter is not found

Recall that we used the following syntax to extract the first word from cell A2:

=IFERROR(TEXTBEFORE(A2, " "), A2)

We first use the TEXTBEFORE function to extract all text before the first space in cell A2.

This function will return an error if there is only one word in the cell, so we use the IFERROR function to specify that we should return all text in the cell if there is only one word.

The end result is that we’re able to extract the first word from the cell.

Note: You can find the complete documentation for the TEXTBEFORE function in Excel .


x