How can I extract text between two characters in Excel? 2

How can I extract text between two characters in Excel?

Extracting text between two characters in Excel can be achieved using the “MID” function. This function allows you to specify the starting position and the number of characters to extract from a given cell. By using this function along with the “FIND” function to locate the desired characters, you can easily extract the text between them. This can be useful for separating strings of data or extracting specific information from a cell. By following these steps, you can efficiently extract text between two characters in Excel.

Excel: Extract Text Between Two Characters


You can use the TEXTBEFORE and TEXTAFTER functions in Excel to extract all text in a cell between two specific characters or strings.

You can use the following syntax to do so:

=TEXTBEFORE(TEXTAFTER(A2, "this"), "that")

This particular example extracts all of the text between the characters “this” and “that” in cell A2.

The following examples show some common ways to extract text between two characters in practice.

Example 1: Extract Text Between Strings

We can type the following formula into cell B2 to extract the text in cell A2 between the strings “ran” and “miles”:

=TEXTBEFORE(TEXTAFTER(A2, "ran"), "miles")

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

Excel extract text between strings

Column B contains the text between the strings “ran” and “miles” for each corresponding cell in column A.

Example 2: Extract Text Between Parentheses

We can type the following formula into cell B2 to extract the text in cell A2 between the parentheses:

=TEXTBEFORE(TEXTAFTER(A2, "("), ")")

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

Excel extract text between parentheses

Column B contains the text between the parentheses for each corresponding cell in column A.

Example 3: Extract Text Between Asterisks

We can type the following formula into cell B2 to extract the text in cell A2 between the asterisks :

=TEXTBEFORE(TEXTAFTER(A2, "*"), "*")

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

Column B contains the text between the asterisks for each corresponding cell in column A.

The following tutorials explain how to perform other common tasks in Excel:

Cite this article

stats writer (2024). How can I extract text between two characters in Excel?. PSYCHOLOGICAL SCALES. Retrieved from https://scales.arabpsychology.com/stats/how-can-i-extract-text-between-two-characters-in-excel/

stats writer. "How can I extract text between two characters in Excel?." PSYCHOLOGICAL SCALES, 22 Jun. 2024, https://scales.arabpsychology.com/stats/how-can-i-extract-text-between-two-characters-in-excel/.

stats writer. "How can I extract text between two characters in Excel?." PSYCHOLOGICAL SCALES, 2024. https://scales.arabpsychology.com/stats/how-can-i-extract-text-between-two-characters-in-excel/.

stats writer (2024) 'How can I extract text between two characters in Excel?', PSYCHOLOGICAL SCALES. Available at: https://scales.arabpsychology.com/stats/how-can-i-extract-text-between-two-characters-in-excel/.

[1] stats writer, "How can I extract text between two characters in Excel?," PSYCHOLOGICAL SCALES, vol. X, no. Y, ص Z-Z, June, 2024.

stats writer. How can I extract text between two characters in Excel?. PSYCHOLOGICAL SCALES. 2024;vol(issue):pages.

Download Post (.PDF)
Slide Up
x
PDF
Scroll to Top