跳到主要內容

如何在Excel中刪除重複項並替換為空白單元格?

通常,當您在 Excel 中應用刪除重複項命令時,它會刪除整個重複行。 但有時,您希望空白單元格替換重複值,在這種情況下,刪除重複項命令將不起作用。 本文將指導您刪除重複項並將其替換為 Excel 中的空白單元格。

刪除重複項並用公式替換為空白單元格
使用Kutools for Excel刪除重複項並替換為空白單元格


刪除重複項並用公式替換為空白單元格

如果範圍內有重複數據,則以下兩個公式將指導您用範圍內的空白替換重複項。 請執行以下操作:

1.選擇一個空白單元格以輸出結果,例如單元格D2,在其中輸入以下公式,然後按 Enter 鍵。 

=IF(A2="","",IF(COUNTIF($A2:A15,A2)=1,A2,""))

2.選擇結果單元格,然後在要應用此公式的範圍內拖動填充手柄。
然後,您可以看到所有重複項(第一個重複項除外)都被替換為空白。 查看屏幕截圖:

尖端:如果您需要用空白單元格替換所有重複的值(包括第一個值)並且僅將唯一值保持在範圍內,則以下公式可以為您提供幫助,並且您將獲得以下結果:

=IF(A2="", "", IF(COUNTIF(A$2:A$15,A2)>1,"",A2))

注意: 您可以根據需要在上述兩個公式中更改單元格引用。


使用Kutools for Excel刪除重複項並替換為空白單元格

選擇重複和唯一單元格 的效用 Excel的Kutools 可以幫助您快速選擇一個範圍內的所有重複單元格,然後只能按鍵盤中的Delete鍵將其刪除。 

申請前 Excel的Kutools首先下載並安裝.

1.選擇要應用此實用程序的範圍。

2。 點擊 庫工具 > 選擇 > 選擇重複和唯一單元格.

3。 在裡面 選擇重複和唯一單元格 對話框中選擇 重複(第一個除外) or 全部重複(包括第一個) 根據需要,然後單擊 OK 按鈕。

4.如果選擇了 重複(第一個除外) 選項,將選擇除第一個重複單元格外的所有重複單元格,然後按 刪除 刪除它們的關鍵。 查看屏幕截圖:

如果您選擇了 全部重複(包括第一個) 選項,將一次選擇所有重複的單元格(包括第一個重複的單元格),然後可以按 刪除 刪除它們的關鍵。 查看屏幕截圖:

  如果您想免費試用(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 (16)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
=IF(A2="","",IF(COUNTIF($A2:A15,A2)=1,A2,""))

This doesnt seem to work on Large texts cells. throws #VALUE! Errror


Any solution for that?
This comment was minimized by the moderator on the site
Is there anyway where we could keep the duplicated cell and replace value with a zero??

Say: There are 2 rows in our worksheet with 2 columns "name", "value". It should not remove the name instead replace the value with 0.

Excel 10 ------ Excel 10
Excel 10 ------ Excel 0
This comment was minimized by the moderator on the site
formula returned blank cells
This comment was minimized by the moderator on the site
This small formula also works : =IF(COUNTIF($A$2:A2,A2)=1,A2,"").. Just drag it
This comment was minimized by the moderator on the site
thankx a ton...saved a lot of tym...
This comment was minimized by the moderator on the site
You have shown formula with very clarity, Thereby I got help with easily. If you have any link in which that I can get & search mostly formula by there link. :-)
This comment was minimized by the moderator on the site
Hi, Is there any formula to remove duplicates and replace it with another values in the same sheet
This comment was minimized by the moderator on the site
Hi really need help, i having the same problem however i need the first data and clear out any succeeding duplicates. Like if i have 5 "jane" in a range, i would need 1 "jane"(the very first in line) and delete the rest. I see with the given solution that it actually delete all 5 "jane"s.
This comment was minimized by the moderator on the site
You're a genius!!!! Just saved me half a day :)
This comment was minimized by the moderator on the site
Use the following VBA code Sub RemoveDupes() Dim X As Long For X = 1 To Range("A" & Rows.Count).End(xlUp).Row If Application.WorksheetFunction.CountIf(Range("A1:A" & X), Range("A" & X).Text) > 1 Then Rows(X).ClearContents Next End Sub It works for me. Thanks to Blade Hunter [url]http://www.mrexcel.com/forum/excel-questions/768398-how-remove-duplicates-replace-blank-cells-excel.html#post3766476[/url]
There are no comments posted here yet
Load More
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations