First word of excel

Summary

If you need to extract the first word from some text you can use a formula that uses the FIND and LEFT functions. From the example, the formula looks like this:

=LEFT(B4,FIND(" ",B4)-1)

Generic formula

Explanation 

FIND returns the position (as a number) of the first occurrence of a space character in the text. This position, minus one, is fed into the LEFT function as num_chars.

The LEFT function then extracts characters starting at the the left side of the text, up to (position — 1).

Handling one word

If a cell contains only one word, this formula returns an error. One way to fix this problem is to wrap the original formula in the IFERROR function like so:

=IFERROR(LEFT(B4,FIND(" ",B4)-1),B4)

Translated: if an error occurs, return the original text.

Another simple way to handle the error is to append a space to the cell value before running FIND:

=LEFT(B4,FIND(" ",B4&" ")-1)

This ensures that FIND will always find at least one space, and will therefore not throw an error. When a cell contains more than one word, there is no impact because the formula works only with the first space.

Dave Bruns Profile Picture

AuthorMicrosoft Most Valuable Professional Award

Dave Bruns

Hi — I’m Dave Bruns, and I run Exceljet with my wife, Lisa. Our goal is to help you work faster in Excel. We create short videos, and clear examples of formulas, functions, pivot tables, conditional formatting, and charts.

There are hundreds and hundreds of Excel sites out there. I’ve been to many and most are an exercise in frustration. Found yours today and wanted to let you know that it might be the simplest and easiest site that will get me where I want to go.

Get Training

Quick, clean, and to the point training

Learn Excel with high quality video training. Our videos are quick, clean, and to the point, so you can learn Excel in less time, and easily review key topics when needed. Each video comes with its own practice worksheet.

View Paid Training & Bundles

Help us improve Exceljet

Excel has some wonderful formulas that can help you slice and dice the text data.

Sometimes, when you have the text data, you may want to extract the first word from the text string in a cell.

There are multiple ways you can do this in Excel (using a combination of formulas, using Find and Replace, and using Flash Fill)

In this tutorial, I will show you some really simple ways to extract the first word from a text string in Excel.

Extract the First Word Using Text Formulas

Suppose you have the following dataset, where you want to get the first word from each cell.

Dataset to Extract the first word from text string

The below formula will do this:

=IFERROR(LEFT(A2,FIND(" ",A2)-1),A2)

Formula to find and extract only the first word

Let me explain how this formula works.

The FIND part of the formula is used to find the position of the space character in the text string. When the formula finds the position of the space character, the LEFT function is used to extract all the characters before that first space character in the text string.

While the LEFT formula alone should be enough, it will give you an error in case there is only one word in the cell and no space characters.

To handle this situation, I have wrapped the LEFT formula in the IFERROR formula, which simply returns the original cell content (as there are no space characters indicating that it’s either empty or has only one word).

One good thing about this method is that the result is dynamic. This means that in case you change the original text string in the cells in column A, the formula in column B will automatically update and give the correct result.

In case you don’t want the formula, you can convert it into values.

Extract the First Word Using Find and Replace

Another quick method to extract the first word is to use Find and Replace to remove everything except the first word.

Suppose you have the dataset as shown below:

Dataset to Extract the first word from text string

Below are the steps to use Find and Replace to only get the first word and remove everything else:

  1. Copy the text from column A to column B. This is to make sure that we have the original data as well.
  2. Select all the cells in Column B where you want to get the first wordCopy the text to Column B
  3. Click the Home tabClick the Home tab
  4. In the Editing group, click on Find and Select option and then click on Replace. This will open the Find & Replace dialog box.Click on Replace
  5. In the Find what field, enter  * (one space character followed by the asterisk sign)Enter Space character followed by asterisk in Find what field
  6. Leave the Replace with field emptyLeave the replace with empty
  7. Click on Replace All button.Click on replace all

The above steps would remove everything except the first word in the cells.

result after find and replace

You can also use the keyboard shortcut Control + H to open the Find and Replace dialog box.

How does this work?

In Find what field, we have used a space character followed by the asterisk sign. The asterisk sign (*) is a wild card character that represents any number of characters.

So when we ask Excel to find cells that contain space character followed by the asterisk sign and replace it with blank, it finds the first space character and removes everything after it – leaving us with the first word only.

And in case you a cell that has no text or only one word with no space characters, the above steps would not make any changes to it.

Extract the First Word Using Flash Fill

Another really simple and fast method to extract the first word using Flash Fill.

Flash Fill was introduced in Excel 2013 and is available in all the versions after that. It helps in text manipulation by identifying the pattern that you’re trying to achieve and fills it for the entire column.

For example, suppose you have the below dataset and you want to only extract the first word.

Dataset to Extract the first word from text string

Below are the steps to do this:

  1. In cell B2, which is the adjacent column of our data, manually enter ‘Marketing’ (which is the expected result)Enter the first word in first cell manually
  2. In cell B3, enter ‘HR’Enter manually in second cell
  3. Select the range B2:B10Select the range
  4. Click on the Home tab
  5. In the Editing group, click on the Fill drop-down
  6. Click on Flash Fill optionClick on Flash Fill

The above steps would fill all the cells with the first word from the adjacent column (column A).

Caution: In most cases, Flash Fill works fine and gives the correct result, but in some cases, it may not give you the right result. Just make sure to double-check that the results are as expected.

Note: When typing the expected result in the second cell in column B, you may see all text in all the cells in a light gray color. That is the result you will get if you hit the enter key right away. In case you don’t see the gray line, use the Flash Fill option in the ribbon.

So these are three simple methods to extract the first word from a text string in Excel.

I hope you found this tutorial useful!

Other Excel tutorials you may like:

  • Extract Numbers from a String in Excel (Using Formulas or VBA)
  • How to Extract a Substring in Excel (Using TEXT Formulas)
  • Separate First and Last Name in Excel (Split Names Using Formulas)
  • How to Remove Comma in Excel (from Text and Numbers)
  • How To Remove Text Before Or After a Specific Character In Excel
  • How to Combine First and Last Name in Excel
  • Remove Characters From Left in Excel
  • Separate Text and Numbers in Excel

Return to Excel Formulas List

Download Example Workbook

Download the example workbook

This tutorial will demonstrate how to extract the first word from a cell in Excel & Google Sheets.

Extract first word

Extract First Word From a Text

To extract the first word from a cell, we can use a formula containing the LEFT and FIND functions.

=LEFT(B3,FIND(" ", B3)-1)

Extract First Word Formula

Let’s delve into the more details of the functions used in the above formula.

The FIND Function

We used the FIND function to get the position of the first occurrence of space in the text. By subtracting 1 from this, we can calculate the position of the last letter in the first word.

=FIND(" ",B3)-1

Extract First Word 1st Part of Formula

The LEFT Function

The LEFT Function will extract a certain number of characters from the string, starting from the left. Inputting the result from the FIND Function, gives us the first word:

=LEFT(B3,C3)

Extract First Word 2nd Part of Formula

Error Handling

If the cell only has one word, the formula will return the #VALUE error.

So to prevent the formula from returning an error, we can use the following two options using:

The IFERROR Function

Surround the formula with the IFERROR Function.

=IFERROR(LEFT(B3,FIND("-",B3)-1),B3)

Extract First Word IFERROR

The IFERROR function performs a calculation. If the calculation results in an error, it returns another value (or calculation). Above, the “iferror” value is the original text string.

Simpler Way

Another way to prevent errors is by adding an additional space to the second argument of the FIND function, with ampersand operator, like this:

=LEFT(B3,FIND(" ",B3&" ")-1)

Extract First Word Simple Way to Handle Error

Now the FIND function will always find a space because we’ve appended a space to the end of each string of text.

Non-Space Separators

If the text string is not separated by space but from a different delimiting character, then by simply changing the value of the first argument in the FIND function with that delimiting character, we’ll get the first word from the text.

=LEFT(B3,FIND("-",B3&" ")-1)

Extract First Word Non Space Separator Formula

Get Last Word

Extracting the last word from a string of text is more complicated. One option is to use a formula like this:

=TRIM(RIGHT(SUBSTITUTE(B3," ",REPT(" ",LEN(B3))),LEN(B3)))

Exctract the Last word using 2nd Formula

Extract First Word In Google Sheets

The formula to extract the first word from a text works exactly the same in Google Sheets as in Excel:

Extract First Word In Google Sheets

Skip to content

How to Extract First Word in Excel in Less Than 1 Minute

How to Extract First Word in Excel in Less Than 1 Minute

Do you have a list of full names but it’s all in one column?

And you want to do something with the first name only?

There are plenty of tasks that require the first word of a cell to be separated in a column on its own.

Mail merge, sorting and filtering, and more…

In this tutorial, you learn three different methods to get the first word from a text string.

Take a look at this conversation:

chat example list

It looks like Mika needs help to get the names from this list:

Gary – apples, bananas, oranges
Tina – spaghetti
Maggie – cake, cupcakes
Elena – chicken pasta
Luke
Henry
Eric – pizza, ice cream
Tony – soft drinks
Mika
Peter – beef curry, porkchop

This might only take less than a minute since there are just 10 items on the list. But what if the list was doubled to 20? Or even 100?

Open a new Excel workbook and let’s see how we can automatically do this!

Copy the list above into a new workbook

Extract the first word from text using the LEFT function

The LEFT function extracts a specified number of characters from the left side of a given text string. It has two input arguments:

Type =LEFT( into a cell to see the tooltip
  • text is the source string and this is usually a cell reference
  • num_chars – is the number of characters that will be extracted

Since the name is just the first word of each text string in the list, you need to count all characters before the first space character ” “.

To do this, use the FIND function.

It returns the position of a given character/string within another text string. The input arguments of the FIND function are:

Type =FIND( into a cell to see the FIND function tooltip
  • find_text is the character/string you are looking for
  • within_text is where Excel will look for find_text
  • start_num is the starting position of the search. This is optional and by default, the search starts from the very left side.

Let’s see these two functions in action:

1. In cell B1, type:

=FIND(” “, A1)

2. Hit Enter.

The Excel FIND function returns the cell value 5

The formula returns the first space character’s position. You can then subtract 1 to get the length of the name without the space which is 4.

Now, use this in the LEFT function.

3. Change cell B1 to the below formula:

=LEFT(A1, FIND(” “, A1)-1)

You can also use the TRIM function to remove the space:

=TRIM(LEFT(A1, FIND(” “, A1)))

Kasper Langmann, Microsoft Office Specialist
The get first word before space Excel formula

5. Fill in the rest of the rows using the Fill Handle.

This find first word formula works well except for those 3 rows with the #VALUE! error

Oh no! 😱

Why did some of the cells return a #VALUE! error?

Since some items on the list only have one word, the FIND function failed to identify a space within the text string.

To fix this, the formula should include a way to catch this error and return the entire text string from Column A instead.

Workaround: Fix errors if the cell contains only one word

The IFERROR function checks if the intended formula or value returns an error. If yes, it will instead use the formula in value_if_error.

Let’s try it out.

1. In cell B1, the current formula becomes the first argument of the IFERROR function and the second argument will be the input text which is just cell A1.

=IFERROR(LEFT(A1, FIND(” “, A1)-1),A1)

IFERROR is combined with the LEFT and FIND function

3. Hit Enter then fill in the rest.

The new grab first word Excel formula works perfectly

Extract the first word in Excel using Find and Replace

The LEFT function works well but you can also do the same without a formula.

1. Copy the list from Column A to Column B.

2. Press Ctrl + F to open Find and Replace.

3. On the Replace tab:

  • Find what: Enter ” *” (one space followed by an asterisk).
    The asterisk “*” is a wildcard character that represents any number of characters.
  • Replace with: Leave it blank.

This tells Excel to select a space character and all other characters that come after. It then replaces this selection with nothing thus removing it entirely from the text string.

Find and Replace can be used to handle any text string in Excel

3. Hit the Replace All button.

Find and replace removed all other words than the first

Extract the first word in Excel using Flash Fill

Finally, let’s use one of the smartest features in Excel. 💡

Flash Fill detects the most likely pattern from your data set and automatically reproduces it.

First, you need to give Excel an example of your intended result. Simple patterns such as “find first word” or “get last word” need only one or two examples.

1. In cell B1, type the first word which is “Gary”. Do this for cell B2 as well.

2. On the Excel ribbon, click the Data tab then click Flash Fill.

You can also use the shortcut Ctrl + E

And watch Flash Fill do its magic!

Flash fill just extracted all first names from the text

As you have just learned in the “get first word” task, you can use a formula, Find and Replace, or Flash Fill to easily work with any text string in Excel.

Now you can use this to streamline your work and become an Excel pro! 📈

But why streamline data like this?

Because it makes your work with the important functions and features much easier.

What important functions and features?

IF, SUMIF, VLOOKUP, and pivot tables.

And you learn all of those in my free 30-minute online course.

Read all about it (and enroll) here.

Kasper Langmann2023-02-23T14:41:21+00:00

Page load link

Содержание

  1. Get First Word in Excel & Google Sheets
  2. Extract First Word From a Text
  3. The FIND Function
  4. The LEFT Function
  5. Error Handling
  6. The IFERROR Function
  7. Simpler Way
  8. Non-Space Separators
  9. Get Last Word
  10. Extract First Word In Google Sheets
  11. How to Extract the First Word from a Text String in Excel (3 Easy Ways)
  12. Extract the First Word Using Text Formulas
  13. Extract the First Word Using Find and Replace
  14. Extract the First Word Using Flash Fill
  15. How to Extract First Word in Excel in Less Than 1 Minute
  16. Extract the first word from text using the LEFT function
  17. Workaround: Fix errors if the cell contains only one word
  18. Extract the first word in Excel using Find and Replace
  19. Extract the first word in Excel using Flash Fill

Get First Word in Excel & Google Sheets

Download the example workbook

This tutorial will demonstrate how to extract the first word from a cell in Excel & Google Sheets.

To extract the first word from a cell, we can use a formula containing the LEFT and FIND functions.

Let’s delve into the more details of the functions used in the above formula.

The FIND Function

We used the FIND function to get the position of the first occurrence of space in the text. By subtracting 1 from this, we can calculate the position of the last letter in the first word.

The LEFT Function

The LEFT Function will extract a certain number of characters from the string, starting from the left. Inputting the result from the FIND Function, gives us the first word:

Error Handling

If the cell only has one word, the formula will return the #VALUE error.

So to prevent the formula from returning an error, we can use the following two options using:

The IFERROR Function

Surround the formula with the IFERROR Function.

The IFERROR function performs a calculation. If the calculation results in an error, it returns another value (or calculation). Above, the “iferror” value is the original text string.

Simpler Way

Another way to prevent errors is by adding an additional space to the second argument of the FIND function, with ampersand operator, like this:

Now the FIND function will always find a space because we’ve appended a space to the end of each string of text.

Non-Space Separators

If the text string is not separated by space but from a different delimiting character, then by simply changing the value of the first argument in the FIND function with that delimiting character, we’ll get the first word from the text.

Get Last Word

Extracting the last word from a string of text is more complicated. One option is to use a formula like this:

The formula to extract the first word from a text works exactly the same in Google Sheets as in Excel:

Источник

Excel has some wonderful formulas that can help you slice and dice the text data.

Sometimes, when you have the text data, you may want to extract the first word from the text string in a cell.

There are multiple ways you can do this in Excel (using a combination of formulas, using Find and Replace, and using Flash Fill)

In this tutorial, I will show you some really simple ways to extract the first word from a text string in Excel.

This Tutorial Covers:

Suppose you have the following dataset, where you want to get the first word from each cell.

The below formula will do this:

Let me explain how this formula works.

The FIND part of the formula is used to find the position of the space character in the text string. When the formula finds the position of the space character, the LEFT function is used to extract all the characters before that first space character in the text string.

While the LEFT formula alone should be enough, it will give you an error in case there is only one word in the cell and no space characters.

To handle this situation, I have wrapped the LEFT formula in the IFERROR formula, which simply returns the original cell content (as there are no space characters indicating that it’s either empty or has only one word).

One good thing about this method is that the result is dynamic. This means that in case you change the original text string in the cells in column A, the formula in column B will automatically update and give the correct result.

In case you don’t want the formula, you can convert it into values.

Extract the First Word Using Find and Replace

Another quick method to extract the first word is to use Find and Replace to remove everything except the first word.

Suppose you have the dataset as shown below:

Below are the steps to use Find and Replace to only get the first word and remove everything else:

  1. Copy the text from column A to column B. This is to make sure that we have the original data as well.
  2. Select all the cells in Column B where you want to get the first word
  3. Click the Home tab
  4. In the Editing group, click on Find and Select option and then click on Replace. This will open the Find & Replace dialog box.
  5. In the Find what field, enter * (one space character followed by the asterisk sign)
  6. Leave the Replace with field empty
  7. Click on Replace All button.

The above steps would remove everything except the first word in the cells.

How does this work?

In Find what field, we have used a space character followed by the asterisk sign. The asterisk sign (*) is a wild card character that represents any number of characters.

So when we ask Excel to find cells that contain space character followed by the asterisk sign and replace it with blank, it finds the first space character and removes everything after it – leaving us with the first word only.

And in case you a cell that has no text or only one word with no space characters, the above steps would not make any changes to it.

Another really simple and fast method to extract the first word using Flash Fill.

Flash Fill was introduced in Excel 2013 and is available in all the versions after that. It helps in text manipulation by identifying the pattern that you’re trying to achieve and fills it for the entire column.

For example, suppose you have the below dataset and you want to only extract the first word.

Below are the steps to do this:

  1. In cell B2, which is the adjacent column of our data, manually enter ‘Marketing’ (which is the expected result)
  2. In cell B3, enter ‘HR’
  3. Select the range B2:B10
  4. Click on the Home tab
  5. In the Editing group, click on the Fill drop-down
  6. Click on Flash Fill option

The above steps would fill all the cells with the first word from the adjacent column (column A).

Note: When typing the expected result in the second cell in column B, you may see all text in all the cells in a light gray color. That is the result you will get if you hit the enter key right away. In case you don’t see the gray line, use the Flash Fill option in the ribbon.

So these are three simple methods to extract the first word from a text string in Excel.

I hope you found this tutorial useful!

Other Excel tutorials you may like:

Источник

Do you have a list of full names but it’s all in one column?

And you want to do something with the first name only?

There are plenty of tasks that require the first word of a cell to be separated in a column on its own.

Mail merge, sorting and filtering, and more…

In this tutorial, you learn three different methods to get the first word from a text string.

Table of Contents

Take a look at this conversation:

It looks like Mika needs help to get the names from this list:

Gary – apples, bananas, oranges
Tina – spaghetti
Maggie – cake, cupcakes
Elena – chicken pasta
Luke
Henry
Eric – pizza, ice cream
Tony – soft drinks
Mika
Peter – beef curry, porkchop

This might only take less than a minute since there are just 10 items on the list. But what if the list was doubled to 20? Or even 100?

Open a new Excel workbook and let’s see how we can automatically do this!

The LEFT function extracts a specified number of characters from the left side of a given text string. It has two input arguments:

  • text is the source string and this is usually a cell reference
  • num_chars – is the number of characters that will be extracted

Since the name is just the first word of each text string in the list, you need to count all characters before the first space character ” “.

To do this, use the FIND function.

It returns the position of a given character/string within another text string. The input arguments of the FIND function are:

  • find_text is the character/string you are looking for
  • within_text is where Excel will look for find_text
  • start_num is the starting position of the search. This is optional and by default, the search starts from the very left side.

Let’s see these two functions in action:

1. In cell B1, type:

2. Hit Enter.

The formula returns the first space character’s position. You can then subtract 1 to get the length of the name without the space which is 4.

Now, use this in the LEFT function.

3. Change cell B1 to the below formula:

=LEFT(A1, FIND(” “, A1)-1)

You can also use the TRIM function to remove the space:

=TRIM(LEFT(A1, FIND(” “, A1)))

5. Fill in the rest of the rows using the Fill Handle.

Why did some of the cells return a #VALUE! error?

Since some items on the list only have one word, the FIND function failed to identify a space within the text string.

To fix this, the formula should include a way to catch this error and return the entire text string from Column A instead.

Workaround: Fix errors if the cell contains only one word

The IFERROR function checks if the intended formula or value returns an error. If yes, it will instead use the formula in value_if_error.

Let’s try it out.

1. In cell B1, the current formula becomes the first argument of the IFERROR function and the second argument will be the input text which is just cell A1.

=IFERROR(LEFT(A1, FIND(” “, A1)-1),A1)

3. Hit Enter then fill in the rest.

The LEFT function works well but you can also do the same without a formula.

1. Copy the list from Column A to Column B.

2. Press Ctrl + F to open Find and Replace.

3. On the Replace tab:

  • Find what: Enter ” *” (one space followed by an asterisk).
    The asterisk “*” is a wildcard character that represents any number of characters.
  • Replace with: Leave it blank.

This tells Excel to select a space character and all other characters that come after. It then replaces this selection with nothing thus removing it entirely from the text string.

3. Hit the Replace All button.

Finally, let’s use one of the smartest features in Excel. 💡

Flash Fill detects the most likely pattern from your data set and automatically reproduces it.

First, you need to give Excel an example of your intended result. Simple patterns such as “find first word” or “get last word” need only one or two examples.

1. In cell B1, type the first word which is “Gary”. Do this for cell B2 as well.

2. On the Excel ribbon, click the Data tab then click Flash Fill.

And watch Flash Fill do its magic!

As you have just learned in the “get first word” task, you can use a formula, Find and Replace, or Flash Fill to easily work with any text string in Excel.

Now you can use this to streamline your work and become an Excel pro! 📈

But why streamline data like this?

Because it makes your work with the important functions and features much easier.

What important functions and features?

IF, SUMIF, VLOOKUP, and pivot tables.

And you learn all of those in my free 30-minute online course.

Источник

Понравилась статья? Поделить с друзьями:
  • First word of dream
  • First word in title
  • First word in the english language
  • First word in string java
  • First word in css