WPS Office

Free All-in-One Office Suite with PDF Editor

correct-icon

Edit Word, Excel, and PPT for FREE.

correct-icon

Read, edit, and convert PDFs with the powerful PDF toolkit.

correct-icon

Microsoft-like interface, easy to use.

Free download

Windows • MacOS • Linux • iOS • Android

banner

How to Extract Text Before Character in Excel

August 1, 2022
11.3K Views

Extracting Text before character helps you retrieve the desired information from a more extensive data set, thus enhancing data management and simplifying complex data processing tasks. There are different methods of extracting texts in Excel, but using the built-in functions is the most effective and efficient one. Identifying the best way to Extract Text before characters in Excel is a crucial challenge. This guide will cover the best three simple methods to extract text in Excel, so stick until the end.

Method 1: Use Find and Replace to Extract Text Before the Character

Step 1: Open Excel and select the desired data.

Step 2: Press “CTRL + H” on your keyboard. It will open a window of Find and Replace functionality.

excel extract text before character

Step 3: There are three different options that you can perform.

  • To eliminate text before a given character, type the character preceded by an asterisk (*char).

  • To remove text after a particular character, type the character followed by an asterisk (char*).

  • To delete a substring between two characters, type an asterisk surrounded by two characters (char*char).

Step 4: In the example, we will eliminate last names after the “.”

Step 5: To remove the last name from the data, use the * and the “.”

how to extract text before character in Excel

Pros

  • Straightforward method.

  • No complex formulas or functions are required.

  • Works with single and multiple occurrences and multiple occurrences

Cons

  • Less Flexible in dynamic data handling

Method 2: Use the Formula to Extract Text Before the Character

Step 1: Select the text where you want to Extract text before the character.

Step 2: Use the following formula to extract text.
"=LEFT(CellReference, FIND("Character," CellReference)-1)"

Step 3: In our example, we want to extract the text before the “.” where the cell reference starts from A1. This is how our formula will look.

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

excel extract text after numbers of character

Step 4: It will yield the following results eliminating all the characters after the “.” and the output is like.

excel how to extract text before a character

Step 5: If you want to extract a specific number of characters from the original text, you may use the formula =Left(Cell, Number).

Step 6: It would give you the leftmost characters equivalent to the number given as input. For example, we want to extract five characters from the left so that the formula will be
=LEFT(A2,5). The output is given below.

excel formula to extract text before a character

Pro Tips: 

1. If the character is Space, the formula should include the Trim function

The TRIM function in Excel is used to remove excess spaces from a text string. This way, the TRIM function will eliminate all the additional spaces and implement the rest of the formula.

For example, if you have the text "Hello. World" in cell A1, applying the formula "=LEFT(TRIM(A1), FIND(".", TRIM(A1))-1)" will extract the text "Hello" as a result.

excel functions to extract text before a character

2. If you want to Extract text After the character, please use the right function

=Right(Cell, Len(Cell)-Find(“Character”,Cell))

This formula is used in Excel to extract a portion of text from the right side of a given text string, starting from a specific character.

For example, if you have the text "Hello World" in cell A1 and you want to extract the text starting from the space character (" "), the formula "=RIGHT(A1, LEN(A1)-FIND(", "A1))" will return "World" as the extracted text.

how to extract text before a character using excel funciton

Pros

  • Provides flexibility in extracting text

  • Allows for dynamic extraction

  • Can handle complex extraction

  • Offers more precise control

Cons

  • Complex for beginners

  • Time-consuming for larger data sets

Method 3: How to Extract Text Between Two Characters in Excel

Step 1: Suppose you have data in curly braces like {Hello World}. We will remove the braces and retrieve Hello World Only using the Mid function.

Step 2: We will use the following formula;

=MID(A1, FIND("{", A1) + 1, FIND("}", A1) - FIND("{", A1) - 1)

This formula uses the MID function to extract the text starting from the character after the opening curly brace ("{") and extracts the number of characters between the opening and closing curly braces.

extract text before comma excel

Step 3: We can achieve similar results with the SUBSTITUTE function. The formula will look like this =SUBSTITUTE(SUBSTITUTE(A1, "{", ""), "}", "") giving the same results.

excel extract text after character

FAQs

Q1: What are the differences between the Find and SEARCH functions?

The main difference between Excel's Find and SEARCH functions is that the Find function is case-sensitive, while the SEARCH function is case-insensitive. Additionally, the Find function allows wildcard characters, such as asterisks (*) and question marks (?), while the SEARCH function does not.

Q2: How do you split a string before a character in Excel?

To split a string before a specific character in Excel, you can combine the LEFT and FIND or SEARCH functions. The LEFT function extracts a specified number of characters from the beginning of a text, and the FIND or SEARCH function locates the position of the desired character. Combining these functions allows you to extract the desired substring before the specified character.

Summary

Excel is an excellent tool for spreadsheet processing, and data analysis becomes a piece of cake when it comes to using a combination of functions. The three methods mentioned in this tutorial are probably the easiest and fastest to extract text before a character in Excel. Moreover, if you are tech-savvy, you can play with these combinations to make them more efficient and productive. If you are not comfortable with using these complex formulas, it is recommended to try WPS Office.

WPS Office is a free alternative to MS Office and has an excellent spreadsheet processor. It is compatible with MS Office, so you can work with different software in the same file format. Unlike MS Excel, WPS Spreadsheet is lightweight and easy to use, even for beginners. If you haven’t tried it, download it now and enjoy the free, lightweight alternative to MS Excel.

15 years of office industry experience, tech lover and copywriter. Follow me for product reviews, comparisons, and recommendations for new apps and software.