Tip: Other languages are Google-Translated. You can visit the English version of this link.
Log in
x
or
x
x
Register
x

or

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

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

doc remove first last 1 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
doc remove first last 2

>> 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
doc remove first last 3

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
doc remove first last 4


remove position

This Remove Characters Tool Boosts Your Efficiency By 90%, Leave Much Time To Enjoy Your Life

▲ Say goodbye to modifying and memorizing formulas, give you a full rest on brain.

▲ Except this tool, there are 228 advanced tools (including 30+ text editing tools) else in Kutools for Excel, which can solve your 80% Excel puzzles.

▲ Become an Excel expert in 5 minutes, gain people's recognition and promotion.

▲ 110000+ high efficiency people and 300+ world renowned companies' choice.

60-days free trial, no credit card required


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
doc remove first last 5

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
doc remove first last 6


ot move

Do You Want To Have A Pay Raise and Much Time To Accompany With Family?

Office Tab Enhances Your Efficiency By 50% In Microsoft Office Working Right Now

Unbelievable, working at two or more documents is easier and faster than working at one.

Compareed with well-known browsers, the tabbed tool in Office Tab is more powerful and more efficient.

Reduce hundreds of mouse-clicks and keyboard typing every day for you, say goodbye to the mouse hand now.

If you usually work at multiple documents, Office Tab will be a great time-saver for you.

30-day free trial, no credit card required.

Read MoreDownload Now


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.

Now, Make You Work Faster And Better Than Others, Get Promotion With Ease

35 Text Editing Tools For Excel Improve Your 90% Productivity In Text Processing And Leave Much Time To Enjoy Life

These tools just one part of Kutools for Excel, there are 194 tools else can solve 80% Excel puzzles for you.

  • Kutools for Excel help you easily deal with 1500+ working scenarios, averagely improve your 71% efficiency every day
  • One-click to complete most of complicated operations, avoid mouse hand caused by thousands of mouse-clicks for you.
  • You can seconds handle Excel tasks without searching painful formula and VBA, and have much more time to accompany with your family.
  • Choosed by 110000+ highly efficiency peoples and more than 300 world well-known enterprise.

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.
doc remove first last 7

3.1 Remove first/last N characters without formula

>> Remove first N characters

doc remove first last 8

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:
doc remove first last 9

>> Remove last N characters

doc remove first last 10

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:
doc remove first last 11

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.

doc remove first last 12

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:
doc remove first last 13

Remove characters by position without formulas

remove by position

Tip: If you want to remove all numeric, alpha, non-numeric, non-alpha or specific characters from cells, you can apply Kutools for Excel's Remove Characters utility.
remove by characters

More tips on removing characters...


Download sample file

sample


How To Make You Stand Out From Crowd, Easily Work And Leisurely Enjoy Life?

Kutools for Excel will averagely improve your 70% efficiency every day, make you have much time to accompany with family and have fun in life.

300+ advanced tools solve 80% Excel problems, you no longer struggle to search solutions, more easily complete work.

Easily handle 1500+ Excel scenarios, save at least 1 hour for you every day.

Become an Excel expert in 5 minutes, gain peoples’ recognition and opportunity for promotion.

One-click utilities handle batch processing, let you avoid thousands of mouse-clicks, say good-bye to mouse hand.

Get rid of rote memorizing formulas and complex VBA, give a rest to your brain.

110000+ high efficiency officers and 300+ world renowned companies’ choice.

Only take $39 but much worth than $4000 training of other people

60 days free trial without any limitation, full money back in 60-day without any reasons.


Recommended Productivity Tools

Office Tab - Tabbed Browsing, Editing, Managing Of Documents In Microsoft Office 2019 - 2003 And Office 365


office tab

Kutools for Excel - Collects More Than 300 Advanced Tools for saving 50% time in your daily Excel work


kutools tab
kutoolsp tab
Say something here...
symbols left.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.
  • To post as a guest, your comment is unpublished.
    Krets · 7 days ago
    "658414 Mottagares kundnummer Menigo Rutt VÄX319" is my information, but I'm only interested in the last six letters/numbers. Any ideas?
  • To post as a guest, your comment is unpublished.
    cgst · 3 months ago
    "A/P MALKAWATHE,,TALUKA SOUTH SOLAPUR,SOLAPUR,Solapur,413252" this is my data. I want pincode separated from the data. by using =RIGHT(P2,LEN(P2)-6) it is not working.
  • To post as a guest, your comment is unpublished.
    shivraj · 6 months ago
    nice its work nice thank you very much
  • To post as a guest, your comment is unpublished.
    TerriMo · 1 years ago
    Just what I needed!
  • To post as a guest, your comment is unpublished.
    Truls Sønsteby · 1 years ago
    I can't make this formula work, I type : =LEFT(A1,LEN(A1)-4) and it gives error everytime.
    My A1 column has the following data: ELDB-AK-S-42228-001


    Why isn't this working?
    • To post as a guest, your comment is unpublished.
      sobhan · 5 months ago
      use ; instead of , in your formula
    • To post as a guest, your comment is unpublished.
      Nick · 8 months ago
      I was originally having issues because I was using this formula within 2 other (IF and ROUND) and able to get this formula to work by removing the LEN
    • To post as a guest, your comment is unpublished.
      Alex · 8 months ago
      Format your Cells to Special Characters.
    • To post as a guest, your comment is unpublished.
      Sunny · 1 years ago
      Sorry I do not know what happen to your sheet, it works successfully in my workbook