How to highlight duplicates in Excel: Duplicate Values and COUNTIF rules
Find duplicates by color in Excel: the Duplicate Values rule, highlighting whole rows, flagging only repeat occurrences, and the long-number and trailing-space traps.
A cashier is checking the payment log: if a receipt was entered twice, the customer was charged twice or the report overstates revenue. In a 500-row log you can’t spot that by eye.
Before you delete duplicates, you need to see them: which ones are real mistakes and which are legitimate repeats (two purchases by the same customer, for instance). Excel’s conditional formatting does exactly that — it colors repeated values and leaves the data untouched.
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Receipt # | Customer | Amount | |
| 2 | A-1021 | Aziz Karimov | 450 000 | |
| 3 | A-1022 | Dilnoza Rakhimova | 1 200 000 | |
| 4 | A-1023 | Javokhir Turaev | 320 000 | |
| 5 | A-1022 | Dilnoza Rakhimova | 1 200 000 | |
| 6 | A-1024 | Malika Yusupova | 780 000 | |
| 7 | A-1025 | Sardor Aliev | 150 000 | |
| 8 | A-1021 | Aziz Karimov | 450 000 | |
| 9 |
Method 1: Duplicate Values — two clicks
1
Select the column to check (A2:A8). Главная → Условное форматирование → Highlight Cells Rules.
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Receipt # | Customer | ||
| 2 | A-1021 | Aziz Karimov | ||
| 3 | A-1022 | Dilnoza Rakhimova | ||
| 4 | A-1023 | Javokhir Turaev | ||
| 5 | A-1022 | Dilnoza Rakhimova | ||
| 6 |
2
In the submenu choose the last item, Duplicate Values...
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Receipt # | Customer | ||
| 2 | A-1021 | Aziz Karimov | ||
| 3 | A-1022 | Dilnoza Rakhimova | ||
| 4 | A-1023 | Javokhir Turaev | ||
| 5 | A-1022 | Dilnoza Rakhimova | ||
| 6 |
3
The dialog shows Duplicate on the left and a color on the right (default Light Red Fill with Dark Red Text). Click OK — repeated receipts turn red.
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Receipt # | Customer | ||
| 2 | A-1021 | Aziz Karimov | ||
| 3 | A-1022 | Dilnoza Rakhimova | ||
| 4 | A-1023 | Javokhir Turaev | ||
| 5 | A-1022 | Dilnoza Rakhimova | ||
| 6 |
4
To see only the repeats: turn on the filter (Ctrl + Shift + L) → column A → Filter by Color → red.
Method 2: a formula rule — whole row, repeats only
1
Duplicate Values colors the first copy too. Often you want to keep the original and see only the extra copies. Select the whole table (A2:C8) → Условное форматирование → New Rule... → Use a formula to determine which cells to format.
2
Enter =СЧЁТЕСЛИ($A$2:$A2;$A2)>1. Meaning: “from the top of the table down to this row, has this receipt appeared more than once?” The first occurrence is 1 (not colored), the second is 2 (colored).
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Receipt # | Customer | Amount | |
| 2 | A-1021 | Aziz Karimov | 450 000 | |
| 3 | A-1022 | Dilnoza Rakhimova | 1 200 000 | |
| 4 | A-1023 | Javokhir Turaev | 320 000 | |
| 5 |
3
The $ in $A2 locks the column: cells in B and C are also checked against column A, so the whole row gets colored. The result: only rows 5 and 8.
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Receipt # | Customer | Amount | |
| 2 | A-1021 | Aziz Karimov | 450 000 | |
| 3 | A-1022 | Dilnoza Rakhimova | 1 200 000 | |
| 4 | A-1023 | Javokhir Turaev | 320 000 | |
| 5 | A-1022 | Dilnoza Rakhimova | 1 200 000 | |
| 6 | A-1024 | Malika Yusupova | 780 000 | |
| 7 | A-1025 | Sardor Aliev | 150 000 | |
| 8 | A-1021 | Aziz Karimov | 450 000 | |
| 9 |
Method 3: a helper column — count and filter
1
If you need a flag for printing or for further formulas, type =СЧЁТЕСЛИ($A$2:$A$8;A2) in D2 (how many times in total) and =ЕСЛИ(СЧЁТЕСЛИ($A$2:A2;A2)>1;"Repeat";"") in E2 (which occurrence), then fill down.
| A | B | C | D | E | F | |
|---|---|---|---|---|---|---|
| 1 | Receipt # | Customer | Amount | Total | Flag | |
| 2 | A-1021 | Aziz Karimov | 450 000 | 2 | ||
| 3 | A-1022 | Dilnoza Rakhimova | 1 200 000 | 2 | ||
| 4 | A-1023 | Javokhir Turaev | 320 000 | 1 | ||
| 5 | A-1022 | Dilnoza Rakhimova | 1 200 000 | 2 | Repeat | |
| 6 | A-1024 | Malika Yusupova | 780 000 | 1 | ||
| 7 | A-1025 | Sardor Aliev | 150 000 | 1 | ||
| 8 | A-1021 | Aziz Karimov | 450 000 | 2 | Repeat | |
| 9 |
2
Filter column E for “Repeat” — only the extra rows remain. Select and delete them, then clear the filter.
Pro level: duplicates across several columns and managing rules
- Two columns repeating together: the same customer paid the same amount twice —
=СЧЁТЕСЛИМН($B$2:$B$8;$B2;$C$2:$C$8;$C2)>1. A repeat in one column can be normal; in both at once it is suspicious. - The reverse — find unique values: in the Duplicate Values dialog choose Unique instead of Duplicate — only values that occur once are colored.
- Rule range: if new rows aren’t covered, open Условное форматирование → Manage Rules... and extend the range in Applies to. Better still, turn the range into a table (Ctrl + T) first — the rule then extends to new rows automatically.
- Common values of two lists: select both ranges with Ctrl and apply Duplicate Values — what appears in both gets colored.
Try it in the simulator
The simulator has no conditional formatting, so flag repeats with formulas: type =СЧЁТЕСЛИ($A$2:$A$8;A2) in D2 and fill down to D8. Then type =ЕСЛИ(СЧЁТЕСЛИ($A$2:A2;A2)>1;"Repeat";"") in E2 to find only the extra copies.
| A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | Receipt # | Customer | Amount | Total | Flag | |||||||||||||||||||
| 2 | A-1021 | Aziz Karimov | 450000 | |||||||||||||||||||||
| 3 | A-1022 | Dilnoza Rakhimova | 1200000 | |||||||||||||||||||||
| 4 | A-1023 | Javokhir Turaev | 320000 | |||||||||||||||||||||
| 5 | A-1022 | Dilnoza Rakhimova | 1200000 | |||||||||||||||||||||
| 6 | A-1024 | Malika Yusupova | 780000 | |||||||||||||||||||||
| 7 | A-1025 | Sardor Aliev | 150000 | |||||||||||||||||||||
| 8 | A-1021 | Aziz Karimov | 450000 | |||||||||||||||||||||
| 9 | ||||||||||||||||||||||||
| 10 | ||||||||||||||||||||||||
| 11 | ||||||||||||||||||||||||
| 12 |
Has ExcelLab been useful?
Support the project and help us release new lessons and exercises.