Find Duplicate query
Discussion
Not sure if I am missing something here but can't seem to get this to work.
I have a workbook with hundereds perhaps even thousands of rows.
I want to higlight duplicate values but only if multiple columns are the same.
Assuming the following is in Column A, B & C;
1 2 3
1 2 2
1 2 3
1 2 4
I want it to only highlight row 1 and 3 as duplicates, is this possible?
I have a workbook with hundereds perhaps even thousands of rows.
I want to higlight duplicate values but only if multiple columns are the same.
Assuming the following is in Column A, B & C;
1 2 3
1 2 2
1 2 3
1 2 4
I want it to only highlight row 1 and 3 as duplicates, is this possible?
Sort the data by the columns you want to test, so that any duplicates are next to each other. Then add a column with a formula that tests the row below on those columns to see if it's the same. If it is, return a flag, if it isn't, look to see if the row above is the same, if it is return a flag. If it isn't, return nothing.
Eg. IF(AND(A5=A6, B5=B6,C5=C6)=TRUE, 1, IF(AND(A5=A4, B5=B4, C5=C4)=TRUE, 2, ""))
This will give you a column that you can use to highlight duplicates, which is what you asked for as apposed to the solutions above that are deleting the duplicates. If you want to delete the duplicates, by labelling them 1 and 2, you can choose which to delete, or use the Remove Duplicates tool that's built in.
Eg. IF(AND(A5=A6, B5=B6,C5=C6)=TRUE, 1, IF(AND(A5=A4, B5=B4, C5=C4)=TRUE, 2, ""))
This will give you a column that you can use to highlight duplicates, which is what you asked for as apposed to the solutions above that are deleting the duplicates. If you want to delete the duplicates, by labelling them 1 and 2, you can choose which to delete, or use the Remove Duplicates tool that's built in.
I assuming your use of the word workbook means you are talking spreadsheet not database, this would work with both but there are better ways to do it with a database.
A fourth column is correct but use a hash function on the fields you want to use for duplicate detection. In layman terms a hash function will add up all the values of the chosen fields to create a single hash value. Rows with identical hash values mean all the fields are equal. There are some technical caveats but they shouldn't cause you any issue here if manually review each highlighted duplicate before action. Sort by the hash column to surface the duplicates.
The main limitation of a hash function is that it may create some false positives, but the chance of this on few thousand records is vanishingly small. It will not miss duplicates.
A fourth column is correct but use a hash function on the fields you want to use for duplicate detection. In layman terms a hash function will add up all the values of the chosen fields to create a single hash value. Rows with identical hash values mean all the fields are equal. There are some technical caveats but they shouldn't cause you any issue here if manually review each highlighted duplicate before action. Sort by the hash column to surface the duplicates.
The main limitation of a hash function is that it may create some false positives, but the chance of this on few thousand records is vanishingly small. It will not miss duplicates.
Edited by 4x4Tyke on Monday 12th March 10:29
Gassing Station | Computers, Gadgets & Stuff | Top of Page | What's New | My Stuff



