2009年11月18日 星期三

Use Conditional Formatting to Flag/Mark/Highlight Duplicates in Excel

Let us assume the range we want to highlight duplicates is the range A1:A100.

1) Select range A1:A100 Starting from A1. This will ensure the active cell is A1

2) Go to Format>Conditional Formatting and choose "Formula is"

3) In the right hand box type the formula as show below;

=COUNTIF($A$1:$A$100,A1)>1



4) Click the "Format" button and choose any desired format to apply to any duplicate entries.

5) Click "Ok" then "Ok" again and we are done!

Now, all duplicates in the range A1:A100 will have the format you have chosen. It is important to note the Absolute of $A$1:$A$100 in the COUNTIF function and that the single reference (A1) is a Relative reference. This is why step 1 states to Start from A1 (in this case) ensuring A1 becomes the active cell. The "Formula is" in the Conditional Formatting for A2 will change automatically to;

=COUNTIF($A$1:$A$100,A2)>1

Note the $A$1:$A$100 never changes due to the use of Absolute on both the column ("A") and the rows (1:100)

沒有留言: