Skip to main content

How to remove first or last n characters from a cell or string in Excel?

Author Sun Last modified

This tutorial demonstrates different quick tricks to remove first or last N characters from a cell or a string in Excel.

remove first last chars 1. Remove first N characters with formula/UDF
2. Remove last N characters with formula/UDF
3. Batch remove N characters from left or right or mid without formulas
4. Download sample file

1. Remove first N characters with formulas

In this part, I introduce three different ways to quickly remove first N characters from a string.

1.1 Remove first N characters with RIGHT / REPLACE function

>> Combine RIGHT and LEN function to remove first N characters

Formula syntax and arguments

Formula:    =RIGHT(string_cell,LEN(string_cell)-n_character)

Reference: string_cell: the cell you use to remove characters

n_character: the number of characters you want to remove

Example: Remove first 2 characters from string in Cell A2, copy and paste the formula
=RIGHT(A2,LEN(A2)-2)
press Enter key
Remove first N characters with right function

>> REPLACE function to remove first N characters

Formula syntax and arguments

Formula:    =REPLACE(Old_text,Strat_n,Num_Chars,New_text)

Reference: Old_text: the cell you use to replace characters

Old_text: the cell you use to replace characters

Start_n: the position of the character in old_text that you want to replace with new_text

Num_Chars: the number of characters in old text that you want to replace with new_text

New_text: the text that will replace the old_text

Example: Replace first two characters with nothing in Cell A6, copy and paste this formula:
=REPLACE(A6,1,2,"")
press Enter key
Remove first N characters with replace function

1.2 Remove first N characters with user defined function

1. Press Alt + F11 keys to enable Microsoft Visual Basic for Applications window, then click Insert > Module to create a Module.

2. Copy below code and paste them to the Module script.

VBA Code: Remove first n characters

Public Function RemoveFirstC(rng As String, cnt As Long)
RemoveFirstC = Right(rng, Len(rng) - cnt)
End Function

3. Save the code and go back to the sheet you use. For example, remove first 3 characters from string in Cell A11, copy and paste this formula
=RemoveFirstC(A11,3)
press Enter key
Remove first N characters with user defined function


2. Remove last N characters with formulas

In this part, there are two ways for removing last N characters from string in Excel.

2.1 Remove last N characters with LEFT function

Formula syntax and arguments

Formula:    =LEFT(string_cell,LEN(string_cell)-Num_chars)

Reference: string_cell: the cell you use to remove characters

n_character: the number of characters you want to remove

Example: Remove last 2 characters from string in Cell A2, copy and paste the formula
=LEFT(A2,LEN(A2)-2)
press Enter key
Remove last N characters with left function

2.2 Remove last N characters with user defined function

1. Press Alt + F11 keys to enable Microsoft Visual Basic for Applications window, click Insert > Module to create a Module.

2. Copy below code and paste them to the Module script.

VBA Code: Remove last n characters

Public Function RemoveLastC(rng As String, cnt As Long)
RemoveLastC = Left(rng, Len(rng) - cnt)
End Function

3. Save the code and go back to the sheet you use. For example, remove last 3 characters from string in Cell A5, type this formula
=RemoveLastC(A5,3)
press Enter key
Remove last N characters with user defined function


3. Remove N characters from left or right or mid without formulas

If you do not want to waste time to remember formulas to deal with the task on removing N characters from left or right of a string, the Remove by Position utility of Kutools for Excel can handle this task with clicks without any formulas.

Kutools for Excel offers over 300 advanced features to streamline complex tasks, boosting creativity and efficiency. Itegarate with AI capabilities, Kutools automates tasks with precision, making data management effortless. Detailed information of Kutools for Excel...         Free trial...

After free installing Kutools for Excel, please do as below:

Select the cells you want to remove characters from, applying the utility by clicking Kutools > Text > Remove by Position.
click Remove by Position feature of kutools

3.1 Remove first/last N characters without formula

>> Remove first N characters

set options in the dialog to remove first N characters

1) In Numbers textbox, type the number of characters you want to remove from string, in this example, I will remove first 3 characters from strings.

2) Check From left option in Position section.

Result is displayed as:
the result to remove first n chars

>> Remove last N characters

set options in the dialog to remove last N characters

1) In Numbers textbox, type the number of characters you want to remove from string, in this example, I will remove last 3 characters from strings.

2) Check From right option in Position section.

Result is displayed as:
the result to remove last n chars

3.2 Remove N characters from a middle specific position without formula

But in sometimes, you may want to remove a specific number of characters from the middle of a string.

Example: Remove 3 characters starts from the third characters from the string.

set options to remove N characters from a middle

1) In Number text, type the number of characters you want to remove from the strings, here I will remove 3 characters.

2) Check Specify option, then type the number which you want to remove string start from in beside textbox in Position section, here I will remove characters from third character.

Result is displayed as:
the result to remove  n chars in middle


Download sample file

sample


Best Office Productivity Tools

🤖 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 Lookup: Multiple Criteria VLookup    Multiple Value VLookup  |   VLookup Across Multiple Sheets   |   Fuzzy Lookup ....
Advanced Drop-down List: Quickly Create 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 Ranges & Columns ...
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 Cells, ...)   |   ... and more
Use Kutools in your preferred language – supports English, Spanish, German, French, Chinese, and 40+ others!

Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time.  Click Here to Get The Feature You Need The Most...


Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier

  • Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
  • Open and create multiple documents in new tabs of the same window, rather than in new windows.
  • Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!