Excel duplicate values — Find, review, and remove duplicate rows

Last content update 2026-10-25
Service guide
Excel duplicate values
View service guide →
QUICK ANSWER
To find duplicates, select the range and choose Home → Conditional Formatting → Highlight Cells Rules → Duplicate Values. To delete them, copy the original first, then choose comparison columns under Data → Remove Duplicates. The first row with each combination of selected values remains. Other columns in a removed row are deleted too, within the selected table or range. Clearing a column's checkbox does not preserve its values, so check the full range and the rows you intend to keep.

Finding duplicates and deleting them are different tasks

GoalFeatureChanges original values?
See whether values repeatConditional FormattingNo
Temporarily hide duplicates to review unique recordsAdvanced FilterNo
Delete duplicate rowsRemove DuplicatesYes
Count occurrencesCOUNTIF or COUNTIFSNo

Use highlighting or a formula to review the data first. Only run Remove Duplicates after deciding what counts as a duplicate. The menus below follow Windows desktop Excel. The service-guide button opens this article’s Korean original; the general Excel guide is also in Korean.

Highlight duplicate values

  1. Select the data range without the heading row.
  2. Choose Home → Conditional Formatting → Highlight Cells Rules → Duplicate Values.
  3. Select the format for duplicate cells and confirm.
  4. Add a filter to review rows by color or value.

Conditional formatting compares cell values. Highlighting names alone can flag different people with the same name, so also check identifiers such as employee IDs, phone numbers, or order IDs.

See Excel filters: apply and clear conditions for reviewing rows by value or numeric conditions and clearing conditions to show the full data again.

Count occurrences with COUNTIF

To count how often each value occurs in A2:A100, enter this formula in an adjacent helper column:

=COUNTIF($A$2:$A$100,A2)

A result of 1 means the value occurs once; 2 or more indicates repetition. For rows where both the order ID and product code match, use COUNTIFS:

=COUNTIFS($A$2:$A$100,A2,$B$2:$B$100,B2)

Filter by the formula result to review each group before deleting rows. These examples use commas between arguments; your regional settings may require a different list separator.

Remove duplicate rows

  1. Copy the original worksheet or workbook.
  2. Select a cell in the complete data range you want to process.
  3. Choose Data → Remove Duplicates.
  4. Check whether the first row contains headers.
  5. Select only the columns that should define a duplicate.
  6. Confirm, then review the reported numbers of removed duplicates and remaining unique values.

To keep one row per order, select the order ID column. If an order can contain several products that must remain, select both order ID and product code.

Comparison columns versus the deletion range

The checkboxes define which values identify a matching row. They do not protect unchecked columns from deletion. If the selected range contains order ID, product code, and quantity, removing a duplicate row also removes its quantity within that range. This is different from deleting the entire worksheet row, including cells outside the selected range.

This original example illustrates the comparison keys. Decide which records to delete in real order data using your own business rules.

Original data rowOrder IDProduct codeQuantity
11001A2
21001B3
31001A5
41002A1
Columns checkedRows keptQuantity removedTotal left
Order IDRows 1 and 43 from row 2; 5 from row 33
Order ID and product codeRows 1, 2, and 45 from row 36

Even with both order ID and product code selected, row 3 is removed despite its different quantity. If that quantity difference represents a separate record you need to preserve, reconsider the comparison key. Leaving Quantity unchecked does not keep its data.

Keep the original: Copy the original range to another sheet or file first. Check the selected range, intended surviving rows, row count, and totals after deletion. Do not assume that hiding rows with a filter protects the data you need.

Remove outlines or subtotals before using Remove Duplicates on such data. The reported counts can include empty cells or spaces, so review the remaining data as well as the completion message.

Sort to keep the intended row

Remove Duplicates keeps the first matching row from the top. Sort first if you need a recent record or a particular status to take priority.

  • Sort dates newest first to prioritize the latest revision.
  • Use a custom status order to prioritize completed records.
  • If required fields must be filled, define the row priority first, sort, and check that the surviving records actually contain those fields in a copy.
  • Add a sequence-number column before sorting if you need to restore the original order.

For several sort criteria, set their priority under Data → Sort before removing duplicates.

Distinguish Remove Duplicates from formula comparisons

Microsoft notes that duplicate comparison can depend on what is displayed in the cell, not just the stored value. The same date shown as 2026-10-21 and October 21, 2026, for example, can be treated as different by Remove Duplicates.

Make display formats consistent in the comparison columns and check the result in a copy. Conditional formatting, COUNTIF, and COUNTIFS help with review before deletion; do not assume all features use identical comparison rules or produce identical results.

Check values that do not match as expected

First identify which feature gives an unexpected result, then compare the original and helper columns.

  • Look for spaces or line breaks at the beginning or end of a cell.
  • Check for mixed numeric 1001 and text '1001 values.
  • Check whether dates contain times that are not displayed.
  • Check for different underlying decimal values even when formula results look alike.

Use functions such as TRIM, CLEAN, VALUE, or ROUND in helper columns to prepare comparison values while preserving the originals. TRIM and CLEAN do not remove every kind of Unicode space or character. Checking dates, times, and decimals helps explain differences between stored values and display formats; it does not mean Remove Duplicates will merge every differently displayed value.

Reconcile the numbers after removal

Check more than the number of deleted rows reported by the dialog:

  1. Total row count before and after removal
  2. Number of unique keys, such as order IDs or employee IDs
  3. Whether amount and quantity totals changed as intended

The right result depends on whether the records are duplicate transactions or legitimate rows for different products in the same order.

Official sources

Frequently asked questions

How do I highlight duplicate values in Excel?
Select the range, then choose Home → Conditional Formatting → Highlight Cells Rules → Duplicate Values and select a format. This highlights matching cells without deleting their values.
Which row does Remove Duplicates keep?
It keeps the first occurrence of each combination of selected column values and removes later matching rows. Sort first if you need to prioritize the latest or most complete record, then check the actual result in a copy.
Can I remove rows only when several columns match?
Select several comparison columns in Data → Remove Duplicates. For example, compare order ID alone or order ID together with product code. Columns you leave unchecked are still deleted within the table or range when their row is removed.
Why can the same date produce different duplicate-removal results?
Microsoft explains that duplicate comparison depends on what appears in a cell. The same stored date with different display formats can be treated differently. Make the formats consistent and check a copy; a COUNTIF result does not guarantee the same Remove Duplicates result.
Why are apparently identical cells not highlighted as duplicates?
Check for leading or trailing spaces, numbers stored as text, and different underlying dates or times. Prepare helper values with functions such as TRIM and consistent data types, then compare again without overwriting the original column.
What formula counts duplicate values?
For values in A2:A100, enter =COUNTIF($A$2:$A$100,A2) in B2 and fill down. A result of 2 or more means the value occurs more than once in that range. Use COUNTIFS for combinations of columns.
Can I undo Remove Duplicates?
Ctrl+Z can undo the operation immediately, but recovery may become difficult after closing the file or continuing other work. Copy the original range to another worksheet or workbook before removing anything.