跳到主要內容

如何從Excel中的數字中刪除前導撇號?

doc刪除前撇號1

假設您有一個數字列表,前面帶有一個隱藏的撇號,並且僅當在以下屏幕快照中選擇該單元格時,該撇號才會在公式欄中顯示。 現在,您想從單元格值中刪除前導撇號。 要逐個刪除它們會花費很多時間,在這裡,我將討論一些解決此問題的快速技巧。

使用粘貼作為值從數字中刪除前導撇號

從帶有文本到列的數字中刪除前導撇號

使用VBA代碼從數字中刪除前導撇號

使用Kutools for Excel從數字中刪除開頭的撇號


您可以使用一個簡單的功能– 粘貼為值 要完成此任務,請執行以下操作:

1。 選擇要刪除前導撇號的數據范圍,然後按 按Ctrl + C 複製它們。

2。 然後單擊要放入結果的一個單元格,然後單擊鼠標右鍵,然後選擇 123值 來自 粘貼選項,請參見屏幕截圖:

doc刪除前撇號2

3。 您會看到前導撇號已從數字中刪除。

doc刪除前撇號4 2 doc刪除前撇號5

在Excel中, 文字至欄 功能還可以幫助您解決此任務。

1。 選擇要刪除前導撇號的數據范圍。

2。 然後點擊 數據 > 文字至欄,並在中 將文本轉換為列嚮導點擊此處成為Trail Hunter 直接單擊按鈕,請參見屏幕截圖:

doc刪除前撇號6

3。 現在,您會發現所有前導撇號都已從數字中刪除。


如果您對VBA代碼感興趣,我可以為您創建一個代碼來處理此任務。

1。 按住 ALT + F11 鍵,然後打開 Microsoft Visual Basic for Applications 窗口。

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,所有前導撇號已從所選單元格中刪除。


Excel的Kutools在文字和數字之間轉換 實用程序可以幫助您一鍵將格式化為文本的數字轉換為普通數字,並同時刪除前導撇號。

Excel的Kutools : 帶有300多個便捷的Excel加載項,可以在30天內免費試用

安裝後 Excel的Kutools,請執行以下操作:

1。 選擇您要使用的數據范圍。

2。 點擊 庫工具 > 內容 > 在文字和數字之間轉換,請參見屏幕截圖:

3。 在 在文字和數字之間轉換 對話框中選擇 文字轉數字轉換類型,然後單擊 Ok or 登記 按鈕,將存儲為文本的選定數字轉換為實數,並且立即刪除了開頭的撇號。 如果您想將其轉換回去,只需檢查一下 文字編號 in 在文字和數字之間轉換 對話框。查看屏幕截圖:

doc刪除前撇號9 9 2 doc刪除前撇號10 10

單擊以了解有關此在文本和數字之間轉換功能的更多信息。

立即下載和免費試用Excel的Kutools!


Excel的Kutools:具有300多個方便的Excel加載項,可以在30天內免費試用,沒有任何限制。 立即下載並免費試用!

最佳辦公生產力工具

🤖 Kutools 人工智慧助手:基於以下內容徹底改變數據分析: 智慧執行   |  生成代碼  |  建立自訂公式  |  分析數據並產生圖表  |  呼叫 Kutools 函數...
熱門特色: 尋找、突出顯示或識別重複項   |  刪除空白行   |  合併列或儲存格而不遺失數據   |   沒有公式的回合 ...
超級查詢: 多條件VLookup    多值VLookup  |   跨多個工作表的 VLookup   |   模糊查詢 ....
高級下拉列表: 快速建立下拉列表   |  依賴下拉列表   |  多選下拉列表 ....
欄目經理: 新增特定數量的列  |  移動列  |  切換隱藏列的可見性狀態  |  比較範圍和列 ...
特色功能: 網格焦點   |  設計圖   |   大方程式酒吧    工作簿和工作表管理器   |  資源庫 (自動文字)   |  日期選擇器   |  合併工作表   |  加密/解密單元格    按清單發送電子郵件   |  超級濾鏡   |   特殊過濾器 (過濾粗體/斜體/刪除線...)...
前 15 個工具集12 文本 工具 (添加文本, 刪除字符,...)   |   50+ 圖表 類型 (甘特圖,...)   |   40+ 實用 公式 (根據生日計算年齡,...)   |   19 插入 工具 (插入二維碼, 從路徑插入圖片,...)   |   12 轉化 工具 (數字到單詞, 貨幣兌換,...)   |   7 合併與拆分 工具 (高級合併行, 分裂細胞,...)   |   ... 和更多

使用 Kutools for Excel 增強您的 Excel 技能,體驗前所未有的效率。 Kutools for Excel 提供了 300 多種進階功能來提高生產力並節省時間。  點擊此處獲取您最需要的功能...

產品描述


Office選項卡為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