How to automatically remove duplicates in excel
Tutor 5 (87 Reviews)
Excel Tutor
Still stuck with a Excel question
Ask this expertAnswer
To automatically remove duplicates in Excel, you can use the Remove Duplicates tool or apply formulas with conditional formatting. The method depends on whether you want the duplicates deleted permanently or highlighted first.
Method 1: Using the Remove Duplicates Tool
Select the range of cells or the entire table where duplicates may exist.
Go to the Data tab on the Ribbon.
Click Remove Duplicates in the Data Tools group.
In the dialog box that appears:
Select the columns you want Excel to check for duplicates.
Make sure the correct columns are checked; checking multiple columns requires all selected columns to match for a row to be considered duplicate.
Click OK.
Excel will remove duplicate rows and display a message showing how many duplicates were removed and how many unique values remain.
Note: On a Mac, the steps are the same, but the Data tab may be labeled slightly differently as Data Tools → Remove Duplicates.
Method 2: Using Conditional Formatting to Identify Duplicates
Select the range of cells you want to analyze.
Go to the Home tab.
Click Conditional Formatting → Highlight Cells Rules → Duplicate Values.
Choose a formatting style (e.g., color fill) to highlight duplicates.
Click OK.
After duplicates are highlighted, you can manually delete them or use a filter to remove them efficiently.
Method 3: Using Formulas to Flag Duplicates Automatically
You can create a helper column to mark duplicates without deleting data immediately.
Insert a new column next to your data.
In the first cell of the helper column, enter this formula:
=IF(COUNTIF(A:A, A2)>1, "Duplicate", "Unique")
A:Arefers to the column containing the data.A2is the first data cell in the column.
Drag the formula down to apply it to all rows.
Filter the helper column to show only "Duplicate" values.
Delete the rows flagged as duplicates if needed.
Method 4: Using Excel Tables for Automatic Duplicate Handling
Select your dataset and press Ctrl + T (Windows) or Command + T (Mac) to convert it into a table.
Tables automatically expand as you add new data.
Use the Remove Duplicates tool on the table; any new duplicates added later can be removed by repeating the tool.
Note: Excel does not automatically remove duplicates in real-time. Using formulas or macros can simulate automatic removal.
Method 5: Using VBA to Automatically Remove Duplicates
For true automation without manual intervention, you can use a small macro.
Press Alt + F11 to open the VBA editor.
Click Insert → Module.
Paste this code:
Sub RemoveDuplicatesAutomatically()
Dim ws As Worksheet
Set ws = ActiveSheet
ws.Range("A1:A1000").RemoveDuplicates Columns:=1, Header:=xlYes
End Sub
Press F5 to run the macro.
Adjust
"A1:A1000"to match your data range.This macro removes duplicates from column A automatically. You can expand it to multiple columns by changing
Columns:=1toColumns:=Array(1,2)for columns A and B.
Tips and Best Practices
Always backup your data before removing duplicates permanently.
Check whether duplicates are exact matches or partial; partial matches require more advanced formulas like
TRIM,LOWER, orTEXTJOIN.Use Excel Tables when regularly adding new data to maintain organized duplicate removal.
For large datasets, formulas like
COUNTIFmay slow Excel; consider using VBA for efficiency.
Get Online Tutoring or Questions answered by Experts.
You can post a question for a tutor or set up a tutoring session
Answers · 1
How to show duplicates in red
Answers · 1
How to apply duplicate conditional formatting rule
Answers · 1
How to duplicate conditional formatting excel
Answers · 1
What is excel conditional formatting duplicates
Answers · 1