How to Remove Prefix and Suffix in Given Cells in Excel

This post will guide you how to remove suffix form a range of cells in Excel. How do I remove prefix from text string in cells with a formula in Excel.

Sometimes we need to remove prefixes and suffixes from a string to help normalize the data and make it more consistent in the analysis. To remove prefixes and suffixes from cells in Excel, you can use a combination of built-in functions such as LEFT, RIGHT, LEN, and SUBSTITUTE.

Assuming that you have a list of data in range B1:B5, you want to remove the prefix “www.”  or suffix “.com” from the text string in cells. Let’s see the following introduction.

1. Remove Prefix of Cells

If you want to remove prefix characters from the text string in range B1:B5, you can use a formula based on the RIGHT function and the LEN function. Like this:

=RIGHT(B1,LEN(B1)-4)

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

Let’s See How This Formula Works:

The RIGHT function allows you to extract a specified number of characters from the right side of a text string. The text is cell B1, the specified number is provided by formula len(A2) minus 4, 4 is the number of characters in the prefix (www.), so len(B1) minus 4 provides the length of the retained text. You can replace “B1” with the first cell in your data, and number “4” with the number of characters in the prefix.

remove prefix in given range1

Now, You get a new column with modified data.

2. Remove Suffix of Cells

If you want to remove the suffix characters (.com) from the given range of cells in your worksheet, you can use a formula based on the LEFT function and the Len function. Like this:

=LEFT(B1,LEN(B1)-4)

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

remove prefix in given range2

Once all the values are updated, you can copy the data from the column C and (D) and paste it as values in the original column to replace the old values. Anyway, it depends your request.

Through the above two methods, you should be able to remove prefixes and suffixes from cells in Excel.

3. Video: Remove Prefix and Suffix in Given Cells

This video will show you how to remove prefixex or suffixes from a given text string by using LEFT formula in combination with RIGHT function and Len function in Excel 2013/2016/2019/365.

Leave a Reply