← Back to all guides
Technology · 2 min READ

How to Highlight Duplicate Values in Excel Without Deleting Rows

How to Highlight Duplicate Values in Excel Without Deleting Rows guide illustration

Flag repeated IDs, distinguish legitimate line items from accidental repeats, and highlight only later occurrences when the first entry should stay unmarked.

Quick note

Follow these steps at your own pace. Check product terms and prices directly with providers before purchasing.

Quick answer

Select the cells you want to check, then choose Home → Conditional Formatting → Highlight Cells Rules → Duplicate Values. Leave Duplicate selected, pick a color and click OK. Excel highlights every occurrence of a repeated value and leaves the records in place.

1. Decide what counts as a repeat

An order number can appear twice because the customer bought two different items. A shipment tracking number might have a different rule. Choose the column that answers your question. For this example, enter the table below in A1:C4. Check whether an order appears on more than one line.

OrderItemUnits
K41Mug2
K42Tray1
K41Lid2

2. Apply the rule to the ID column

Select A2:A4, leaving out the header, item names and quantities. Go to Home → Conditional Formatting → Highlight Cells Rules → Duplicate Values. Select Duplicate, pick a fill you can distinguish from the normal cell color and click OK. Both K41 cells should be highlighted. K42 should remain plain.

Selecting the whole grid would also flag repeated quantities such as 2. It would make it harder to tell which order numbers actually need review.

3. Check the records beside the highlighted cells

Read across rows 2 and 4. One line is for mugs and the other is for lids. Those lines may both belong on the order. Change A4 to K43 for a moment. The highlights in A2 and A4 should disappear because each ID is now unique. Undo the change with Ctrl+Z.

4. Highlight only the second and later appearances

To try a different rule, open Conditional Formatting → Manage Rules with A2:A4 selected. Delete only the duplicate rule you just created and apply the change. Select A2:A4 again, choose New Rule → Use a formula to determine which cells to format and enter =AND(A2<>"",COUNTIF($A$2:A2,A2)>1). Choose a fill under Format and confirm both dialogs. Only A4 should light up.

Why the first entry stays plain

The first address in $A$2:A2 stays fixed while the end of the range advances. At row 4 Excel has seen K41 twice. If you sort the list, the first occurrence can change. Decide which record to retain by looking at the actual order details.

Microsoft Support · Find and remove duplicates

SHARE THIS GUIDE

Know someone who could use this?

DISCUSSION

Comments

Read or join the discussion.