跳到主要内容

如何在Excel中删除重复项并替换为空白单元格?

通常,当您在 Excel 中应用删除重复项命令时,它会删除整个重复行。 但有时,您希望空白单元格替换重复值,在这种情况下,删除重复项命令将不起作用。 本文将指导您删除重复项并将其替换为 Excel 中的空白单元格。

删除重复项并用公式替换为空白单元格
使用 Kutools for Excel 删除重复项并替换为空白单元格


删除重复项并用公式替换为空白单元格

如果范围内有重复数据,则以下两个公式将指导您用范围内的空白替换重复项。 请执行以下操作:

1.选择一个空白单元格以输出结果,例如单元格D2,在其中输入以下公式,然后按 输入 键。 

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

2.选择结果单元格,然后将填充手柄拖动到要应用此公式的范围内。
然后,您可以看到所有重复项(第一个重复项除外)都被替换为空白。 查看屏幕截图:

Tips::如果您需要用空白单元格替换所有重复的值(包括第一个值)并且仅将唯一值保持在范围内,则以下公式可以为您提供帮助,并且您将获得以下结果:

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

请注意: 您可以根据需要在上述两个公式中更改单元格引用。


使用 Kutools for Excel 删除重复项并替换为空白单元格

选择重复和唯一单元格 实用程序 Kutools for Excel 可以帮助您快速选择一个范围内的所有重复单元格,然后只能按键盘中的Delete键将其删除。 

申请前 Kutools for Excel首先下载并安装.

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 Tab 为 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