Finding duplicates and deleting them are different tasks
| Goal | Feature | Changes original values? |
|---|---|---|
| See whether values repeat | Conditional Formatting | No |
| Temporarily hide duplicates to review unique records | Advanced Filter | No |
| Delete duplicate rows | Remove Duplicates | Yes |
| Count occurrences | COUNTIF or COUNTIFS | No |
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
- Select the data range without the heading row.
- Choose Home → Conditional Formatting → Highlight Cells Rules → Duplicate Values.
- Select the format for duplicate cells and confirm.
- 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
- Copy the original worksheet or workbook.
- Select a cell in the complete data range you want to process.
- Choose Data → Remove Duplicates.
- Check whether the first row contains headers.
- Select only the columns that should define a duplicate.
- 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 row | Order ID | Product code | Quantity |
|---|---|---|---|
| 1 | 1001 | A | 2 |
| 2 | 1001 | B | 3 |
| 3 | 1001 | A | 5 |
| 4 | 1002 | A | 1 |
| Columns checked | Rows kept | Quantity removed | Total left |
|---|---|---|---|
| Order ID | Rows 1 and 4 | 3 from row 2; 5 from row 3 | 3 |
| Order ID and product code | Rows 1, 2, and 4 | 5 from row 3 | 6 |
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.
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
1001and text'1001values. - 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:
- Total row count before and after removal
- Number of unique keys, such as order IDs or employee IDs
- 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
- Microsoft — Find and remove duplicates ↗
- Microsoft — Comparison columns and the affected range ↗
- Microsoft — COUNTIF syntax and text-matching conditions ↗
- Microsoft — COUNTIFS across multiple ranges ↗
- Microsoft — Clean spaces, nonprinting characters, and numeric text ↗
- Microsoft — ROUND function ↗
- Microsoft Learn — Regional formula separators ↗
