简体   繁体   English

使用或不使用VBA删除Excel中的重复项

[英]Removing Duplicates in Excel with or without VBA

Chart Example 图表范例

Hello All, 大家好,

I am looking for some help in cleaning up an organizational chart that I have in excel. 我正在寻找一些帮助来清理我擅长的组织结构图。 Right now, there are many duplicates as the linked picture shows. 现在,如链接的图片所示,有很多重复项。 I need to remove all the duplicates, and shift the unique values over into the blank spaces 我需要删除所有重复项,并将唯一值移到空白处

(ie, Bill G, Bill G, Fred K, Fred K, Joe X ---> Bill G, Fred K, Joe X). (即Bill G,Bill G,Fred K,Fred K,Joe X ---> Bill G,Fred K,Joe X)。

I have been trying to get it done using Excel Formulas ( =IF(A1=B1, B1, A1) ), but it does not repeat correctly across the Sheet, especially because the different rows have varying numbers of occupied columns. 我一直在尝试使用Excel公式( =IF(A1=B1, B1, A1) )完成此操作,但是在整个工作表中它无法正确重复,尤其是因为不同的行具有不同数量的占用列。

I'd appreciate any help that I can get. 我将不胜感激。 Thank you! 谢谢!

No need for VBA. 无需VBA。 Use Data , Advanced filter , choose Copy to another location and check Unique records only 使用“ Data ,“ Advanced filter ,选择“ Copy to another location并选中“ Unique records only

选择您的范围转到“数据”选项卡在“数据工具”窗格中,选择“删除重复项”

first a formula to bring unique only. 首先带来一个唯一的公式。 the formula display duplicates as 0 . 公式显示重复项为0

在此处输入图片说明

then while still selecting the formula range, open the "go to special" dialog box 然后在仍然选择公式范围的同时,打开“转到特殊”对话框

在此处输入图片说明

select Formulas > Numbers 选择“公式”>“数字”

在此处输入图片说明

all formula output zeros will be selected 将选择所有公式输出零

在此处输入图片说明

press `Ctrl + minus(-) to delete cells, select "shift cells left" 按`Ctrl +减号(-)删除单元格,选择“向左移动单元格”

在此处输入图片说明

end result 最终结果

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM