跳到主要内容

如何从Excel中的字符串中提取前/后n个字符?

例如,在每个单元格中都有一个包含长字符串的列表,您只想从每个字符串中提取前n个字符,就像每个字符串的前3个字符一样,现在您可以使用以下方法在Excel中解决它。

使用公式从字符串中提取前/后n个字符

使用 Kutools for Excel 从字符串中提取第一个/最后一个字符

快速从Excel单元格中删除特殊字符(数字/字母)

只需点击几下 删除字符 的效用 Kutools for Excel,特殊字符将立即从单元格中删除。
点击获取30天免费试用!
doc移除字元
Kutools for Excel:拥有300多个便捷的Excel加载项,可以在30天内免费试用。

箭头蓝色右气泡 使用公式从字符串中提取前/后n个字符

从字符串中提取前n个字符

选择一个空白单元格,在这里我选择单元格G1,然后键入此公式 =左(E1,3) (E1是要从中提取前三个字符的单元格),按 输入 按钮,然后将填充手柄拖到所需的范围。 然后您会看到提取了前3个字符。

如果要提取后n个字符(例如后3个字符),请输入以下公式 =右(E1,3).


箭头蓝色右气泡 使用 Kutools for Excel 从字符串中提取第一个/最后一个字符

按位置删除 的特点 Kutools for Excel 还可以仅从Excel中的字符串中提取前n个或后n个字符。

Kutools for Excel 包括300多个便捷的Excel工具。 30天免费试用,不受限制。 立即获取

1.首先选择要提取的前3个字符的范围,然后单击 库工具 > 文字工具 > 按位置删除。 看截图:

2.在 按位置删除 对话框中,您需要在字符串中输入要从字符串中删除的字符数。 数值 文本框,例如在这种情况下,我想保留前3个字符,因此我需要从右侧删除8个字符,然后检查 从右边。 看截图

3。 点击 Ok,您只会看到前三个字符被保留。

Tips::如果要提取最后3个字符,请选中从左开始,然后指定要从字符串中删除的字符数。

请注意:

1.应用此功能将更改您的原始数据,最好先复制它们。

2.只有每个单元格中的所有字符串都有一些字符,此功能才能正常工作。

单击此处以获取有关按位置删除的更多信息。


相关文章:

最佳办公生产力工具

🤖 Kutools 人工智能助手:基于以下内容彻底改变数据分析: 智能执行   |  生成代码  |  创建自定义公式  |  分析数据并生成图表  |  调用 Kutools 函数...
热门特色: 查找、突出显示或识别重复项   |  删除空白行   |  合并列或单元格而不丢失数据   |   不使用公式进行四舍五入 ...
超级查询: 多条件VLookup    多值VLookup  |   跨多个工作表的 VLookup   |   模糊查询 ....
高级下拉列表: 快速创建下拉列表   |  依赖下拉列表   |  多选下拉列表 ....
列管理器: 添加特定数量的列  |  移动列  |  切换隐藏列的可见性状态  |  比较范围和列 ...
特色功能: 网格焦点   |  设计图   |   大方程式酒吧    工作簿和工作表管理器   |  资源库 (自动文本)   |  日期选择器   |  合并工作表   |  加密/解密单元格    按列表发送电子邮件   |  超级筛选   |   特殊过滤器 (过滤粗体/斜体/删除线...)...
前 15 个工具集12 文本 工具 (添加文本, 删除字符,...)   |   50+ 图表 类型 (甘特图,...)   |   40+ 实用 公式 (根据生日计算年龄,...)   |   19 插入 工具 (插入二维码, 从路径插入图片,...)   |   12 转化 工具 (小写金额转大写, 货币兑换,...)   |   7 合并与拆分 工具 (高级组合行, 分裂细胞,...)   |   ... 和更多

使用 Kutools for Excel 增强您的 Excel 技能,体验前所未有的效率。 Kutools for Excel 提供了 300 多种高级功能来提高生产力并节省时间。  单击此处获取您最需要的功能...

产品描述


Office Tab 为 Office 带来选项卡式界面,让您的工作更加轻松

  • 在Word,Excel,PowerPoint中启用选项卡式编辑和阅读,发布者,Access,Visio和Project。
  • 在同一窗口的新选项卡中而不是在新窗口中打开并创建多个文档。
  • 每天将您的工作效率提高50%,并减少数百次鼠标单击!
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
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations