How to extract first/last n characters from string in Excel?
For instance, there is a list with long strings in each cell, and you want to extract the first n characters from each string only, like the first 3 characters of each string, and now you can use the following methods to solve it in Excel.
Excel Productivity Tools
Office Tab: Bring powerful tabs to Office (include Excel), just like Chrome, Safari, Firefox and Internet Explorer. Save you half the time, and reduce thousands of mouse clicks for you. 30-day Unlimited Free Trial
Kutools for Excel: Save 70% of your time and solve 80% Excel problems for you. 300+ advanced features designed for 1500+ work scenario, make Excel much easy and increase productivity immediately. 60-day Unlimited Free Trial
Extract first n characters from string
Select a blank cell, here I select the Cell G1, and type this formula =LEFT(E1,3) (E1 is the cell you want to extract the first 3 characters from), press Enter button, and drag fill handle to the range you want. Then you see the first 3 characters are extracted.
If you want to extract the last n characters, like the last 3 characters, type this formula = RIGHT(E1, 3).
The Remove by Position feature of Kutools for Excel also can extract the first or last n characters only from strings in Excel.
1. Select the range you want to extract first 3 characters firstly, and click Kutools > Text Tools > Remove by position. See screenshot:
2. In the Remove by Position dialog, you need to type the number of the characters you want to remove from the string into the Numbers textbox, like in this case, I want to reserve the first 3 characters, so I need to remove 8 characters from right, then check From right. See screenshot
3. Click Ok, and you see only the first 3 character are reserved.
Tip: If you want to extract the last 3 characters, check From left and specify the number of the characters you want to remove from the strings.
1. Applying this feature will change your original data, you’d better copy them firstly.
2. Only all the strings in each cell have the some characters long can this feature work.
Excel Productivity Tools
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
To post as a guest, your comment is unpublished.· 17 days agoi'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.
To post as a guest, your comment is unpublished.· 1 years agoI 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