How to Extract Text from a Cell in Excel (5 Ways)

Extracting text from a cell is one of the most common uses of Microsoft Excel. You may need to extract text from the beginning, middle, or from a specific portion of a cell. In this tutorial, we will show you how to extract text from a cell in Excel. By using these simple but effective formulas, you can easily find and extract any part of a string from a cell.


Download Practice Workbook

Download this practice workbook.


5 Ways on How to Extract Text from a Cell in Excel

1.  Using the LEFT Function to Extract Text from a Cell

The LEFT function extracts a particular number of characters from the left of a string.

Syntax of the LEFT Function:

=LEFT(text, [num_chars])

Take a look at this dataset:

dataset for extracting values

Now, using the LEFT function we are going to extract the first 4 characters from the cell.

Step 1:

  • Type the following formula in Cell C5.
=LEFT(B5,4)

formula for extracting text

Step 2:

  • Then press Enter.

result after entering the formula

After that, you will see the extracted text.

Step 3:

  • Next, drag the  Fill Handle over the range of cells C6:C9.

how to extract text from a cell in excel

 

Thus, we have extracted all the text from the left.

Read More: How to Extract Text after a Specific Text in Excel


2. Using the RIGHT Function to Extract Text

The RIGHT function extracts a specific number of characters from the end of a string.

Syntax of the RIGHT Function:

=RIGHT(text,[num_chars])

We are using the same dataset we used for the LEFT function. But, at this time we are going to extract the 4 characters from the right.

Step 1:

  • Now, type the following formula in Cell C5.
=RIGHT(B5,4)

RIGHT function to extract text

Step 2:

  • Then press Enter 

result after entering the formula

 

Our text will be clipped from the right.

Step 3:

  • Next, drag the Fill Handle over the range of Cells C6:C9.

drag fill handle to copy the formula

As you can see, all the cells are containing extracted text from the right


3. Using the MID Function to Extract Text from a Cell in Excel

Now you want a specific portion of a text from the middle of a text. In that case, you can use the MID function to perform this. You have to give a starting number and the number of characters you want to extract.

Syntax of the MID Function:

=MID(text, start_num, num_chars)

Have a look at this dataset. We have some codes divided into 3 parts. In this situation, we are going to extract the middle 4 characters.

dataset for MID function

Step 1:

  • Firstly, type this formula in Cell C5.
=MID(B5,6,4)

MID formula to extract text from a cell

Step 2:

  • Next, press Enter.result for MID function

Step 3:

  • Then, drag the Fill Handle over the range of cells C6:C9.how to extract text from a cell in excel

Ultimately, all the text is clipped from the middle successfully.

Read More: How to Extract Certain Text from a Cell in Excel VBA


4. Extract Text from a Cell Using Formulas

Now, we are going to use some functions to create a formula to extract values from a cell. We are giving three examples of these particular problems.


4.1 Extract Text before a Particular Character

If we want to get a specific substring from a text before a character then we have to first find the character by which we want to extract. For this reason, we are going to use the SEARCH and LEFT functions together.

The Generic Formula:

=LEFT(text,SEARCH(char,cell)-1)

We have a dataset consisting of some codes separated by a hyphen, “-”. Now, we are going to implement the formula to extract the text before the hyphen.

dataset for extracting text before hyphen

Step 1:

  • To begin with, type the following formula in cell C5.
=LEFT(B5,SEARCH("-",B5)-1)

formula to extract text

Step 2:

Then, press Enter.

result after typing the formulaStep 3:

  • After that, drag the Fill Handle over the range of cells C6:C9extracted text from every cell

In the end, we have found all the text before the hyphen.

Read More: Extract Text Before Character in Excel


4.2 Extract Text after a Particular Character

In this formula, we are going to use the RIGHT function along with the LEN and the SEARCH functions.

The Generic Formula:

=RIGHT(text,LEN(text)-SEARCH("char",text))

Take a look at this dataset:

dataset for extracting using formula

Now, we want to pick the characters after the “-” character.

Step 1:

  • Type the following formula in Cell C5:
=RIGHT(B5,LEN(B5)-SEARCH("-",B5))

formula for extracting text

Step 2:

  • Then, press Enter.

result after entering formula

Step 3:

  • Now, drag the Fill Handle over the range of cells C6:C9.extracted texts after using formula

As you can see, we have successfully extracted our desired text from the cell.

Read More: Extract Text After a Character in Excel


4.3  Extract Text between Two Specific Characters from a Cell Using the MID and SEARCH Functions

Sometimes, we may need to pick a substring that is situated between two specific characters.  First of all, we have to specify the two specific occurrences by applying a formula. After that, the MID function will extract the text between those two characters.

Now, we have a dataset of the Full names of some people. In this case, we are going to extract the middle name of the person.

dataset on how to extract text from a cell in excel

Step 1:

  • Type the formula in the Cell C5:
=MID(B5, SEARCH(" ",B5) + 1, SEARCH(" ",B5,SEARCH(" ",B5)+1) - SEARCH(" ",B5) - 1)

enter formula for extracting from middle

Step 2:

  • After that, press Enter. You will see the middle name extracted.

result after entering the formula to extract text from a cell Step 3:

  • Lastly, drag the Fill Handle over the range of Cells C6:C9.extracted texts from the middle

In the end, we are successful in extracting all those middle names.

Read More: How to Extract Text Between Two Commas in Excel


5. Using Find and Replace to Pick Text from a Cell

Now, this method is going to find a specific portion of a text and replace them with no values. To understand this method, often you have to create a new column.

Firstly, take a look at this dataset :

Emails to extract text from a cell in excel

Now, we are going to use this method to find both username and domain name.

 5.1 Extracting Username from the Email

Step 1:

  • Copy the Text column values and paste them on the Extracted Text column.copy text and paste om another column to extract text from a cell

Step 2:

  • Now, select all those values.selecting the text

Step 3:

  • Then, press Ctrl+F on the keyboard. You will find the Find and Replace dialog box.

find and replace to extract text from a cell

Step 4:

  • Here, in the Find What box type “@*.  It will select all the characters starting from the @.
  • Keep the Replace With box blank.
  • Click on Replace All.

find and replace values

Step 5:

  • Now, you will see that 5 replacements have been made. Click OK.extracted text by find and replace dialog box

As you can see, we have successfully extracted all those usernames.


5.2 Extracting the Domain Name

Step 1:

  • Similar to the previous method, copy those emails and paste them on Extracted Text Highlight those and press Ctrl+F.

Find and replace text

Step 2:

  • Now, in the Find What box, type “*@”. It will find all the characters from the beginning along with @.
  • Keep the Replace With box blank.
  • Click on Replace All.

extracted domain names from email

In the end, all the domain names are successfully extracted.


Conclusion

To conclude, I hope these formulas will definitely help you extract specific characters. Download the practice workbook and practice all of these methods. I hope that it will enrich your knowledge.


Extract Text in Excel: Knowledge Hub


<< Go Back to String Manipulation | Learn Excel

Get FREE Advanced Excel Exercises with Solutions!
A.N.M. Mohaimen Shanto
A.N.M. Mohaimen Shanto

A.N.M. Mohaimen Shanto, a B.Sc. in Computer Science and Engineering from Daffodil International University, boasts two years of experience as a Project Manager at Exceldemy. He authored 90+ articles and led teams as a Team Leader, meticulously reviewing over a thousand articles. Currently, he focuses on enhancing article quality. His passion lies in Excel VBA, Data Science, and SEO, where he enjoys simplifying complex ideas to facilitate learning and growth. His journey mirrors Exceldemy's dedication to excellence and... Read Full Bio

4 Comments
  1. Hi, Shanto, I researched your site but can’t figure out how to fix my nagging problem for weeks now. What is a working formula that would convert MM/DD/YY date if it meets a condition. for example: in col. A, the date is 06/01/20; col. B is either condition 1, 2 or 3 Q: what is a formula to convert Col. A date to 06/GG/20 in column 3 if it meets the condition 2 in col. B? formula if it meets condition 3 and it change to 06/EE/20? and if 1, then back to 06/01/20. I would greatly appreciate any help on this? very tough! thanks in advance.

    • Hey Max, try the following VBA code

      Sub Changing_Date_Format_Using_Condition()
      Dim i As Integer

      i = InputBox(“Enter a Number”)

      If i = 2 Then
      Range(“A1”).NumberFormat = “mm/dd/yyyy”
      ElseIf i = 10 Then
      Range(“A2”).NumberFormat = “dddd-dd-mmm-yy”
      Else
      Range(“A3”).NumberFormat = “mmm-yy”
      End If

      End Sub

      Is this your required solution? If not then explain more about it. We will help you to get the result.

  2. hi i want to delete only letter(a-z) in cell which is like below-
    205apple=205
    207dog=207
    805cat=805
    2007grape=2007

    pls help me

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo