Thursday, December 11, 2014

microsoft excel - Finding duplicates in one column based on unique values in another


I have two columns of data, see below:


|---------------------|------------------|
| Email | Number |
|---------------------|------------------|
| email1 | 1 |
|---------------------|------------------|
| email1 | 2 |
|---------------------|------------------|
| email1 | 3 |
|---------------------|------------------|
| email2 | 1 |
|---------------------|------------------|
| email2 | 2 |
|---------------------|------------------|
| email2 | 2 |
|---------------------|------------------|

Can I somehow use conditional formatting to colour the cells where the number column has a duplicate for a unique email? In the table above, the last 2 rows should have their columns colour changed since the number 2 appears two times for the same email.


Thanks in advance!


Answer



This would be the formatting for A2:B7:


=SUM(($A2&$B2=$A$2:$A$7&$B$2:$B$7)*1)>1

I concatenate the A and B columnns and see how many rows match "this" row. The regular result should be 1 - higher values mean duplicates.


Screenshot


No comments:

Post a Comment