How to Extract Text between Two Text Strings in Excel

This post will guide you how to extract text between two given text strings in Excel. How do I get text string between two words with a formula in Excel.

Extract Text between Two Text Strings


Assuming that you have a list of data in range B1:B5, in which contain text string values. And you need to extract all text strings between two words “excel” and “learning” in cells. You can use a formula based on the MID function, the SEARCH function, and the Len function to extract text between two specified strings. Like this:

=MID(B1,SEARCH("excel",B1)+LEN("excel"),SEARCH("learning",B1)-SEARCH("excel",B1)-LEN("excel"))

Type this formula into a blank cell and press Enter key on your keyboard. And then drag the AutoFill Handle down to other cells to apply this formula.

extract text between two words1

You just need to replace words “excel” and “learning” as you need in the above formula.

You should see that the text string have been extracted between two given works in your data.

Related Functions


  • Excel MID function
    The Excel MID function returns a substring from a text string at the position that you specify.The syntax of the MID function is as below:= MID (text, start_num, num_chars)…
  • Excel SEARCH function
    The Excel SEARCH function returns the number of the starting location of a substring in a text string.The syntax of the SEARCH function is as below:= SEARCH  (find_text, within_text,[start_num])…
  • Excel LEN function
    The Excel LEN function returns the length of a text string (the number of characters in a text string).The LEN function is a build-in function in Microsoft Excel and it is categorized as a Text Function.The syntax of the LEN function is as below:= LEN(text)…

 

Related Posts

If Cell Contains Certain Text OR Equals Certain Text

IF cell equals certain text IF function is frequently used in Excel worksheet to return “true value” or “false value” based on the logical test result. If you want to test values to see if they equal certain text like ...

How to Return a Value If a Cell Contains a Specific Text in Excel
return value if cell contains certain value2

This post will guide you how to return a value if a cell contains a certain number or text string in Excel. How do I check if a Cell contains specific text and then return another specific text in another ...

Insert The File Path and Filename into Cell
insert filepath filename in cell5

This post will guide you how to insert the file path and filename into a cell in Excel. Or how to add a file path only in a specified cell with a formula in Excel. Or how to add the ...

Sort Cells by Specific word or words
sort cells by specific words5

This post will guide you how to sort cells or text values in a column based on a specific word even if the word is in the text string in the cell. How do I sort cells in a column ...

Highlight Rows
highlight rows9

This post will teach you how to highlight rows in a table with conditional formatting in Excel. You will learn that how to change the color of the entire rows if the value of cells in a specified column meets ...

How to replace all characters after the first specific character
replace after first commas3

This post will guide you how to replace all characters after the first match of a specific character with a new text string in excel. How to replace all substrings after the first occurrence of the comma character with another ...

How to extract text after the second or nth specific character (space or comma)
extract text after second comma2

In the previous post, we talked that how to extract text after the first occurrence of the comma character in excel. And this post explains that how to get a substring after the second or nth occurrence of the comma ...

How to extract text before the second or nth specific character (space or comma)
extract text before second comma4

Before we talked that how to extract text before the first space or comma character in excel. And this post will guide you how to extract a substring before the second or nth specific character, such as: space or comma ...

How to extract text after first comma or space
extract text after first comma11

In the previous post, we talked that how to extract substring before the first comma or space or others specific characters in excel. And this post will guide you how to extract text after the first comma or space character ...

Check if Cell Contains Certain Values but do not Contain Others Values
contains certain values but do not contain1

In the previous post, we only talked that how to check a cell if contains one of several values from a range in excel. And this post explains that how to check a cell if it contains certain values or ...

Sidebar