Skip to main content

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 AI Aide: Revolutionize data analysis based on: Intelligent Execution   |  Generate Code  |  Create Custom Formulas  |  Analyze Data and Generate Charts  |  Invoke Kutools Functions…
Popular Features: Find, Highlight or Identify Duplicates  |  Delete Blank Rows  |  Combine Columns or Cells without Losing Data  |  Round without Formula ...
Super VLookup: Multiple Criteria  |  Multiple Value  |  Across Multi-Sheets  |  Fuzzy Lookup...
Adv. Drop-down List: Easy Drop Down List  |  Dependent Drop Down List  |  Multi-select Drop Down List...
Column Manager: Add a Specific Number of Columns  |  Move Columns  |  Toggle Visibility Status of Hidden Columns  Compare Columns to Select Same & Different Cells ...
Featured Features: Grid Focus  |  Design View  |  Big Formula Bar  |  Workbook & Sheet Manager | Resource Library (Auto Text)  |  Date Picker  |  Combine Worksheets  |  Encrypt/Decrypt Cells  |  Send Emails by List  |  Super Filter  |  Special Filter (filter bold/italic/strikethrough...) ...
Top 15 Toolsets12 Text Tools (Add Text, Remove Characters ...)  |  50+ Chart Types (Gantt Chart ...)  |  40+ Practical Formulas (Calculate age based on birthday ...)  |  19 Insertion Tools (Insert QR Code, Insert Picture from Path ...)  |  12 Conversion Tools (Numbers to Words, Currency Conversion ...)  |  7 Merge & Split Tools (Advanced Combine Rows, Split Excel Cells ...)  |  ... and more

Kutools for Excel Boasts Over 300 Features, Ensuring That What You Need is Just A Click Away...

Description


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.
Comments (0)
No ratings yet. Be the first to rate!
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
Rate this post:
0   Characters
Suggested Locations