跳到主要内容

如何从Excel中的字符串/数字/单元格中删除字母?

本文讨论如何从 Excel 中的文本字符串/单元格/数字中删除字母。我们提供了四种方法来解决它:数组公式,用户定义函数和Kutools for Excel的第三方插件。


使用数组公式从字符串/数字/单元格中删除字母

我们可以应用数组公式从Excel中的字符串/数字/单元格中删除字母。 请执行以下操作:

1。 选择一个空白单元格,您将返回不带字母的文本字符串,输入公式 =SUM(MID(0&A2,LARGE(INDEX(ISNUMBER(--MID(A2,ROW($1:$99),1))*ROW($1:$99),),ROW($1:$99))+1,1)*10^ROW($1:$99)/10) (A2 是您要从中删除字母的单元格,然后按 按Ctrl + 转移 + 输入 钥匙在同一时间。
doc从文本1删除字母

2。 继续选择该单元格,然后根据需要将其“填充手柄”拖动到该范围。 现在,您将看到从原始文本字符串中删除了所有字母,如下面的屏幕截图所示:

:
(1)此数组公式将删除数字字符以外的所有字符。 例如,原始文本字符串是 abc-859 * -24测试,此数组公式将删除所有字母和特殊字符(*-)并返回 85924.
(2)如果文本字符串中没有数字,则此数组公式将返回0。

批量将文本和数字从一个单元格/列分成不同的列/行

Kutools for Excel 增强了其 分裂细胞 实用程序并支持将一个单元格/列的所有文本字符和数字批量分成两列/行。


广告分割单元格分隔的文字数字

使用用户定义的功能从字符串/数字/单元格中删除字母

我们还可以在Excel中添加用户定义的函数,以从字符串/数字/单元格中删除字母。 请执行以下操作:

1。 按 其他 + F11 同时打开“ Microsoft Visual Basic for Applications”窗口。

2。 点击 插页 > 模块,然后将以下代码复制并粘贴到新打开的“模块”窗口中。

VBA:从Excel中的字符串/数字/单元格中删除字母

Function StripChar(Txt As String) As String
With CreateObject("VBScript.RegExp")
.Global = True
.Pattern = "\D"
StripChar = .Replace(Txt, "")
End With
End Function

3。 保存此用户定义的函数。 选择一个空白单元格,您将返回不带字母的文本字符串,然后输入公式 = StripChar(A2) (A2是要从中删除字母的单元格),然后将“填充手柄”向下拖动到所需的范围。 查看屏幕截图:

笔记:
(1)此用户定义的功能还可以删除数字字符以外的所有字符。 例如,原始文本字符串是 abc-859 * -24测试,此数组公式将删除字母和特殊字符 (* -)并返回 85924.
(2)此用户定义的函数将返回存储为文本字符串的数字。


使用 Kutools for Excel 的 EXTRACTNUMBERS 函数从字符串/数字/单元格中删除字母

这种方法将引入 Kutools for Excel 的 提取号码 函数可在Excel中轻松删除字符串/数字/单元格中的所有字母。 请执行以下操作:

Kutools for Excel - 包含 300 多个 Excel 基本工具。 享受全功能 30 天免费试用,无需信用卡! 现在下载!

1。 选择一个空白单元格,您将返回不带字母的文本字符串,然后单击 库工具 > 主要工作内容 > 文本 > 提取号码。 看截图:

2。 在打开的“函数参数”对话框中,指定要从中删除字母的单元格。 文本 框,键入是可选的 TRUE or N 框,然后单击 OK 按钮。

备注:打字 TRUE 将返回数字,同时不输入任何内容或 FALSE 将返回存储为文本字符串的数字。

3。 继续选择单元格,然后将“填充手柄”拖动到所需的范围。 然后您将看到所有字母都从原始文本字符串中删除。 看截图:

Kutools for Excel - 使用 300 多种基本工具增强 Excel 功能。 享受全功能 30 天免费试用,无需信用卡! 立即行动吧!

笔记:
(1)您可以输入公式 = EXTRACTNUMBERS(A2,TRUE) 直接进入选定的单元格,然后根据需要将“填充”手柄拖动到该范围。
(2)此EXTRACTNUMBERS函数还将删除数字字符以外的所有字符。


使用 Kutools for Excel 的删除字符实用程序从字符串/数字/单元格中删除字母

所有上述方法都会删除除数字字符之外的所有字符。但有时您可能只想从文本字符串中删除字母,但保留数字字符和其他字符。这种方法将引入 Kutools for Excel 的 删除字符 在Excel中轻松完成此操作的实用程序。

Kutools for Excel - 包含 300 多个 Excel 基本工具。 享受全功能 30 天免费试用,无需信用卡! 现在下载!

1。 选择要从中删除字母的单元格,然后单击 库工具 > 文本 > 删除字符.

2。 在打开的“删除字符”对话框中,选中 阿尔法 选项,然后单击 Ok 按钮。 然后您将看到仅字母从选定的单元格中删除。 看截图:
doc从文本6删除字母
备注:如果确实要删除数字字符以外的所有字符,则可以检查 非数值 选项,然后单击 Ok 删除字符对话框中的按钮。 看截图:
doc从文本7删除字母

Kutools for Excel - 使用 300 多种基本工具增强 Excel 功能。 享受全功能 30 天免费试用,无需信用卡! 立即行动吧!


演示:从Excel中的字符串/数字/单元格中删除字母


Kutools for Excel:超过 300 个方便的工具触手可及! 立即开始 30 天免费试用,没有任何功能限制。 立即下载!

相关文章:

最佳办公生产力工具

🤖 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 (9)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Принцип работы формулы массива понял, есть вопрос насчет конкатенации (0&A2), для чего она в формуле?
Если убрать ее и блок +1 после ROW(), формула перестает работать
This comment was minimized by the moderator on the site
NOOOSSAAA!
Você não tem noção do tanto que isso me ajudou!!!
MUITO BOM!
This comment was minimized by the moderator on the site
YEAHHHHHHHHH. At last something that works! Gj!
This comment was minimized by the moderator on the site
I need to delete all text in a cell EXCEPT a specific set of words. For example, a list of fruits or vegetables in column A, and column B has a description of the vegetables, including color, and I want to remove all text in the cells of column B except for color words. Any ideas?
This comment was minimized by the moderator on the site
hi, i want to ask if theres a formula to add period on every abbreviation in one cell within a sentence?

example

825 apple rd st #5 - i want to add period on "rd" and "st" to make it formal


hope you can help me

thanks
This comment was minimized by the moderator on the site
Hi ed,
The Add Text feature of Kutools for Excel may help you solve the problem: https://www.extendoffice.com/product/kutools-for-excel/excel-add-same-text-to-multiple-cells.html
This comment was minimized by the moderator on the site
What if you want to preserve the format of the number or has decimals? i.e Apple30.01? for answer of 30.01? your vb drops the spot?
This comment was minimized by the moderator on the site
Hi Formatunknown,
In this situation, Kutools for Excel’s Remove Characters feature is recommended.
Select the cells, enable the Remove Characters feature, only check the Alpha option, and click the Ok button to remove all alpha characters, and remain numbers including the decimal places.
This comment was minimized by the moderator on the site
Thank u so much
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations