跳到主要内容

如何从Excel中的数字中删除前导撇号?

doc删除前撇号1

假设您有一个数字列表,前面带有一个隐藏的撇号,并且仅当在以下屏幕快照中选择该单元格时,该撇号才会在公式栏中显示。 现在,您想从单元格值中删除前导撇号。 要一一删除它们会花费很多时间,在这里,我将讨论一些解决该问题的快速技巧。

使用粘贴作为值从数字中删除前导撇号

从带有文本到列的数字中删除前导撇号

使用VBA代码从数字中删除前导撇号

使用 Kutools for Excel 从数字中删除前导撇号


您可以使用一个简单的功能– 粘贴为值 要完成此任务,请执行以下操作:

1。 选择要删除前导撇号的数据范围,然后按 按Ctrl + C 复制它们。

2。 然后单击要放入结果的一个单元格,然后单击鼠标右键,然后选择 123值 来自 粘贴选项,请参见屏幕截图:

doc删除前撇号2

3。 您会看到前导撇号已从数字中删除。

doc删除前撇号4 2 doc删除前撇号5

在Excel中, 文字至栏 功能还可以帮助您解决此任务。

1。 选择要删除前导撇号的数据范围。

2。 然后点击 时间 > 文字至栏,而在 将文本转换为列向导,单击“ 完成 直接单击按钮,请参见屏幕截图:

doc删除前撇号6

3。 现在,您会发现所有前导撇号都已从数字中删除。


如果您对VBA代码感兴趣,我可以为您创建一个代码来处理此任务。

1。 按住 ALT + F11 键,然后打开 Microsoft Visual Basic应用程序 窗口。

2。 点击 插页 > 模块,然后将以下代码粘贴到 模块窗口.

VBA代码:从数字中删除前导撇号

Sub remove_Apostrophe()
'Updateby20150521
Dim rng As Range
Dim WorkRng As Range
On Error Resume Next
xTitleId = "KutoolsforExcel"
Set WorkRng = Application.Selection
Set WorkRng = Application.InputBox("Range", xTitleId, WorkRng.Address, Type:=8)
Set WorkRng = WorkRng.SpecialCells(xlCellTypeConstants, xlNumbers)
For Each rng In WorkRng
    If Not rng.HasFormula Then
        rng.Formula = rng.Value
    End If
Next
End Sub

3。 然后按 F5 键以运行此代码,然后在弹出的提示框中选择要使用的数据范围,请参见屏幕截图:

doc删除前撇号7

4。 然后点击 OK,所有前导撇号已从所选单元格中删除。


Kutools for Excel在文字和数字之间转换 实用程序可以帮助您一键将格式化为文本的数字转换为普通数字,并同时删除前导撇号。

Kutools for Excel : 带有300多个便捷的Excel加载项,可以在30天内免费试用

安装后 Kutools for Excel,请执行以下操作:

1。 选择您要使用的数据范围。

2。 点击 库工具 > 内容 > 在文字和数字之间转换,请参见屏幕截图:

3。 在 在文字和数字之间转换 对话框,选择 文字转数字 在下面 转换类型,然后点击 Ok or 使用 按钮,将存储为文本的选定数字转换为实数,并且立即删除了开头的撇号。 如果您想将其转换回去,只需检查一下 文字编号 in 在文字和数字之间转换 对话框。查看屏幕截图:

doc删除前撇号9 9 2 doc删除前撇号10 10

单击以了解有关此在文本和数字之间转换功能的更多信息。

立即下载和免费试用Excel的Kutools!


Kutools for Excel:具有300多个方便的Excel加载项,可以在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
didn't work for me. I acutally needed to save a .txt, and find/replace with notepad++. mine were not showing up as a ', but a ?. not at all visible in Excel. thought I would share my experience in case it helps someone else.
This comment was minimized by the moderator on the site
The 2nd option worked for me with some modifications: 1. I had to set the "Text qualifier" to the single quote2. I had to set the "Column data format" (on the next page) to Text
This comment was minimized by the moderator on the site
This is terrific! Thank you so much for providing a simple way to remove a leading apostrophe from a column. It was driving me crazy. Thanks again for all your help.
This comment was minimized by the moderator on the site
Public Sub REMOVE_APOSTROPHE()

Dim R_CELL As Range
Dim TEMP_VALUE As Variant

For Each R_CELL In Selection

TEMP_VALUE = R_CELL.Value
R_CELL.Clear
R_CELL.Value = TEMP_VALUE

Next R_CELL

End Sub
This comment was minimized by the moderator on the site
Thanks for the tip - I used text to columns; great advice thankyou
This comment was minimized by the moderator on the site
When the first two tricks do not work (this was in my case), I found another simple trick. This trick only works when all cells have the same number of characters behind an annoying ' that cannot be removed for whatever reason. 1-insert column next to cells with ' 2- enter into the new column formula "right" referring to cells with ' and insert no. characters after '. 3- Copy cells with formula-result and paste as values in the original column. 4- remove added column with formula.
This comment was minimized by the moderator on the site
Thanks, text to column work for me... :-)
This comment was minimized by the moderator on the site
i LOVE THE vba CODE in theory but it didn't work :(
This comment was minimized by the moderator on the site
Do you have any suggestions (preferably VBA) for removing apostrophes after numbers in excel? I have an excel file that takes data from an AutoCAD file and many of the values have one or two apostrophes (denoting feet or inches) but unfortunately this makes it unable to run equations on these cells. I know it is possible using "text to cells" but I was hoping using VBA would be possible.
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations