Remove prefix or suffix from string
This tutorial explains two formulas to remove a specific number of prefix or suffix from string in a cell in Excel.
Remove prefix from string with a combination of the RIGHT and LEN functions
Remove suffix from string in a cell with a combination of the LEFT and LEN functions
Remove prefix from string with a combination of the RIGHT and LEN functions
As the below screenshot shown, the prefix you want to remove is always 4 characters long, please do as follows to remove it.
Generic formula
=RIGHT(A1,LEN(A1)-4)
Arguments
A1: Represents the cell containing the string in which you want to remove the prefix.
How to use this formula?
1. Select a blank cell to output the result. In this case, I select D3.
2. Enter the below formula into it and press the Enter key. Select the result cell and then drag its Fill Handle down to apply the formula to other cells.
=RIGHT(B3,LEN(B3)-4)
Note: The number 4 in this formula indicates the leftmost four characters in the string you want to remove. You can change it as you need.v
How this formula works?
=RIGHT(B3,LEN(B3)-4)
1. LEN(B3): The LEN function calculate the total length of text string "001-OT2020-BT", and returns the result as 13;
2. RIGHT(B3,13-4): And then the RIGHT function extracts 9 characters (13-4=9) from the text string "001-OT2020-BT" and returns "OT2020-BT".
Note: As the total length of text string "001-OT2020-BT" is 13, and the prefix you want to remove contains 4 characters, here we need to subtract 4 from 13 to keep only 9 characters of the string.
Remove suffix from string in a cell with a combination of the LEFT and LEN functions
In this case, assuming the suffix you want to remove contains 3 characters as the below screenshot shown. You can use a combination of the LEFT and LEN functions to get it down.
Generic formula
=LEFT(A1,LEN(A1)-3)
Arguments
A1: Represents the cell containing the string in which you want to remove the suffix.
How to use this formula?
1. Select a blank cell to output the result.
2. Enter the below formula into it and press the Enter key. Select the result cell and then drag its Fill Handle down to apply the formula to other cells.
=LEFT(B3,LEN(B3)-3)
Note: In this formula, the number 4 indicates the rightmost 3 characters in the string you want to remove. You can change it as you need.
How this formula works?
=LEFT(B3,LEN(B3)-3)
1. LEN(B3): The LEN function calculate the total length of text string "001-OT2020-BT", and returns the result as 13;
2. LEFT(B3,13-3): And then the RIGHT function extracts 10 characters (13-3=10) from the text string "001-OT2020-BT" and returns "001-OT2020".
Note: As the total length of text string "001-OT2020-BT" is 13, and the suffix you want to remove contains 3 characters, here we need to subtract 3 from 13 to keep only 10 characters of the string.
Related functions
Excel RIGHT function
The Excel RIGHT function extracts a specific number of characters from the right side of the text string.
Excel LEN function
The Excel LEN function returns the number of characters in a text string.
Excel LEFT function
The Excel LEFT function extracts the given number of characters from the left side of a supplied string.
Related formulas
Remove Extension From File Name
This tutorial provides a formula in detailed steps to help you remove extension from a file name in Excel.
Remove First N Characters From Cell
This tutorial introduces two formulas to help you easily remove the first n characters from a cell in Excel.
Remove Line Breaks From Cells In Excel
This tutorial provides three formulas to help you removing line breaks (which are occurred by pressing Alt + Enter keys in a cell) from specific cells in Excel.
Remove Text From Cell By Matching The Content
This article shows you how to use the SUBSTITUTE function to remove part of text string from specified cells by matching content.
Remove Text From A Cell Based On Specific Position
This tutorial explains how to use formulas to remove text from a cell based on specific position in Excel.
The Best Office Productivity Tools
Kutools for Excel - Helps You To Stand Out From Crowd
Kutools for Excel Boasts Over 300 Features, Ensuring That What You Need is Just A Click Away...
Office Tab - Enable Tabbed Reading and Editing in Microsoft Office (include Excel)
- One second to switch between dozens of open documents!
- Reduce hundreds of mouse clicks for you every day, say goodbye to mouse hand.
- Increases your productivity by 50% when viewing and editing multiple documents.
- Brings Efficient Tabs to Office (include Excel), Just Like Chrome, Edge and Firefox.