Skip to main content

How to extract first/last n characters from string in Excel?

Author: Sun Last Modified: 2024-07-05

Extracting specific characters from strings in Excel is a common task, especially when dealing with data cleanup or preparation for analysis. Whether you need the first or last n characters from text entries, Excel provides robust tools to accomplish this with precision. This guide will demonstrate two effective methods: using straightforward Excel formulas and utilizing the advanced features of Kutools for Excel. Each approach caters to different needs, from simple extractions to handling larger datasets efficiently.


Extract first/last n characters from string with formula

In this section, I will show you how to use Excel formulas to extract the first or last N characters from cell strings in Excel.

Extract the first n characters from strings

Select a blank cell, here I select the Cell D6, enter the following formula and press Enter. And then drag the Fill Handle of this formula cell down to get the rest of the results.

=LEFT(B6,4)

Extract the last n characters from strings

To extract the last n characters, like the last 4 characters, enter the following formula in a cell and press Enter. Then drag the Fill Handle of this formula cell down to get the rest of the results.

=RIGHT(B6,4)

Notes: In the above two formulas
  • B6 is the cell from which you want to extract characters.
  • The number 4 indicates you will extract 4 characters from the string.

Easily extract first/last n characters from string with Kutools for Excel

Kutools for Excel offers a significant advantage for users who prefer not to rely on memorizing formulas. Its user-friendly interface and ability to quickly process large datasets make it an ideal tool for enhancing productivity and efficiency in Excel without the complexity of traditional formula-based approaches.

After installing Kutools for Excel, go to select Kutools > Text > Extract Text.

  1. In the Extract Text dialog box, you need to configure as follows:
    1. Stay in the Extract by location tab.
    2. Select the range you want to extract text from.
    3. Select the The first N characters or The last N characters option as you need and specify the number of characters you want to extract.
    4. Click OK.
  2. Another Extract Text dialog box pops up, you need to select a cell to output the extracted characters. Here I select D3.
Result

The first or last N characters has beed extracted from the cells of the selected range.

Kutools for Excel includes more than 300 handy Excel tools. Free to try with no limitation in 30 days. Get it Now


Mastering the techniques to extract first or last n characters from strings in Excel can significantly streamline your data processing tasks. Whether you choose the formula-based method for quick tasks or Kutools for Excel for more complex data sets, both methods provide reliable solutions that enhance your data manipulation capabilities. With these skills, you can ensure that your data is precisely formatted to meet the needs of your analyses, reports, or any other applications that require specific text manipulation.


Relative Articles:


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

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...

Description


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!
Comments (8)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
A1

UAN 101371765394, want only this Specific number 101371765394

Then =MID(A1,4,LEN(A1))
This comment was minimized by the moderator on the site
Line No: 2 AADHAAR XXXX XXXX 7842 is already mapped with UAN 101371765394,101371765394


This is paragraph i want only this number 101371765394.How i can get only number what is the formula for this. Kindly help us
This comment was minimized by the moderator on the site
So I want to build a formula to make a unique id number with a persons first three letters of last name and first 2 letters of first name and zeros to fill in the rest in total 8 characters? Did I ask correctly?
This comment was minimized by the moderator on the site
Hi, Cynthia Ferrera, no one formula can finish that job, but you can use multiple formulas to handle it, if you are interested in the solution, you can view the screen. If you do not want to use such many formulas, you can try Kutools for Excel' Split Names function and Extract Text function to finish the task.
This comment was minimized by the moderator on the site
i'm trying to set up a formula in my current worksheet. i want to remove everything after the first 5 numbers. I cant use kutools app at work. I dont know how to add the formula in to my current one. Any thoughts? the 53090 is what i would want and that is located in cell Q. This is a break down of 75 different numbers for different groups. I have each set of numbers assigned to a different grouping. As of right now i manually have to keep removing the extra numbers from each cell.

=SUM(COUNTIFS($O$12:$O$193,"530",$Q$12:$Q$193,{"53090","53095"}))
This comment was minimized by the moderator on the site
just use left

=left() click on the text you want to use, then the number of characters 5
This comment was minimized by the moderator on the site
hi, The Left/Right function works but it prints number as text. I mean when I try to apply the formula to extracted digits it do not give any output. I hope u understand what I am Trying to say
This comment was minimized by the moderator on the site
I love Kutools explanation needs to say this Kutools works only if the cells have the same number of characters. It won't work if the cells have different number of characters. For example, say I want to extract the first character of these FDIC board members ie, M, L and B. Kutools won't do it. But "=LEFT(E1,3)" in the first technique will work.
Martin J. Gruenberg
Lorraine Dennison
Barbara Ryan
There are no comments posted here yet
Leave your comments
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations