Excel Query - Find duplicates & delete non unique data
Discussion
Hi
I have a spreadsheet with a few thousand IP addresses in column A, a list of the owning department in column B, and a list of the owners in column C.
Some IP addresses are owned by more than one department. These departments may have the same owner, or different owners
Where one IP has a single owner across a number of departments, (see 10.0.0.1 above) I need to delete two of the three rows
Where one IP has multiple different owners, some duplicated across departments, some not, I need to keep one instance for each owner, and delete the rest, so on 10.200.88.99 I would delete one row each for Adam and Arthur
So far I've conditionally formatted column A for duplicates, filtered individual IP, then manually deleted what isn't required.
20 minutes into this and I'm already sick of it. It's not the best use of my time - is there / what is a better way to do this?
Thanks!
I have a spreadsheet with a few thousand IP addresses in column A, a list of the owning department in column B, and a list of the owners in column C.
Some IP addresses are owned by more than one department. These departments may have the same owner, or different owners
IP Address | Department | Owner |
---|---|---|
10.0.0.1 | Sales | Joe Bloggs |
10.0.0.1 | Production | Joe Bloggs |
10.0.0.1 | Engineering | Joe Bloggs |
10.200.88.99 | Sales | Adam Ant |
10.200.88.99 | Sales | Cindy Lating |
10.200.88.99 | Engineering | Arthur Crown |
10.200.88.99 | Production | Adam Ant |
10.200.88.99 | Production | Arthur Crown |
Where one IP has a single owner across a number of departments, (see 10.0.0.1 above) I need to delete two of the three rows
Where one IP has multiple different owners, some duplicated across departments, some not, I need to keep one instance for each owner, and delete the rest, so on 10.200.88.99 I would delete one row each for Adam and Arthur
So far I've conditionally formatted column A for duplicates, filtered individual IP, then manually deleted what isn't required.
20 minutes into this and I'm already sick of it. It's not the best use of my time - is there / what is a better way to do this?
Thanks!
colin79666 said:
Another option would be create a column D that takes the contents of A and C together (=$A1+$C1) then use that to remove duplicates. Repeat as needed with column B in the picture.
Can combine with conditional formatting to highlight duplicates and then filter based on colour. Problem is it picks up the duplicates too.Edited by colin79666 on Friday 18th August 20:31
If you sort the concatenated helper (btw formula should probably be =A1&C1, not =A1+C1) column first, you can do =d2=d1 in column E from row 2 onwards. This will identify if the concatenated value in Column D matches the line above and return TRUE/FALSE. You can then filter for FALSE to identify unique values.
Depending on your version of Excel the new =UNIQUE() formula may work
https://help.chi.ac.uk/excel-unique-function
But the most straightforward idea is imck's pivot table option.
colin79666 said:
Another option would be create a column D that takes the contents of A and C together (=$A1+$C1) then use that to remove duplicates. Repeat as needed with column B in the picture.
This starts as i would. But not sure if the duplicates delete would work easily - thus i would:Edited by colin79666 on Friday 18th August 20:31
I would then sort by D
then in column E - Formula in cell E3 of IF(D3=D2,1,0) - copy down.
Copy D&E paste special values.
Data sort by column E.
Sort by E
Delete all the rows with a 1.
iwantagta said:
I would then sort by D
then in column E - Formula in cell E3 of IF(D3=D2,1,0) - copy down.
Copy D&E paste special values.
Data sort by column E.
Sort by E
Delete all the rows with a 1.
This. It'll take less time than anything else. For a one-off, it does the trick. I've used it many times in 30+ years to clear up dupes. then in column E - Formula in cell E3 of IF(D3=D2,1,0) - copy down.
Copy D&E paste special values.
Data sort by column E.
Sort by E
Delete all the rows with a 1.
Gassing Station | Computers, Gadgets & Stuff | Top of Page | What's New | My Stuff