How to remove duplicate values in excel but keep one
Tutor 5 (62 Reviews)
Excel Tutor
Still stuck with a Excel question
Ask this expertAnswer
To remove duplicate values in Excel but keep one, use the Remove Duplicates tool or Power Query. Both methods delete duplicate rows while retaining the first occurrence of each value. The Remove Duplicates tool is accessible under the Data tab in Excel 2007 and later, while Power Query provides refreshable queries for large datasets in Excel 2016 and later.
Does Excel keep one value when removing duplicates?
Yes, Excel keeps the first occurrence of each duplicate value when using the Remove Duplicates tool or Power Query. Subsequent matching rows are deleted permanently, and the original row remains in place within the dataset.
How to remove duplicates but keep one using the Remove Duplicates tool
To remove duplicates but keep one using the Remove Duplicates tool, select your data range and access the feature through the Data tab. This method permanently alters the original data, so work on a copy when handling critical datasets.
Step-by-step process
- Select the range of cells containing your data, or click any cell within a formatted table. Excel auto-detects the range.
- Navigate to the Data tab, then click Remove Duplicates in the Data Tools group.
- In the dialog box, check the columns to evaluate for duplicates. All columns are selected by default for full-row matching. Check "My data has headers" when your first row contains column labels to exclude it from duplication checks.
- Click OK. Excel removes duplicates, keeps the first occurrence, and displays a summary showing the count of duplicate values removed and unique values remaining.
Column selection considerations
Selecting specific columns checks for matches only in those fields. This approach supports multi-key deduplication, such as checking patient ID and visit date together in clinical datasets. Uncheck "My data has headers" for headerless ranges to avoid unintended removals where labels are treated as data.
Data backup recommendations
The Remove Duplicates tool processes entire contiguous ranges and cannot undo changes after saving. Press Ctrl+Z immediately to reverse the operation when needed. Test on a subset first for large datasets before applying to the full range.
How to remove duplicates but keep one using Power Query
To remove duplicates but keep one using Power Query, load your data into the Power Query Editor and use the Remove Duplicates command. Power Query retains the first occurrence of each duplicate row and deletes subsequent matches.
Step-by-step process
- Select any cell within your data range.
- Go to Data tab, click Get Data, then select From Table/Range. Your data loads into the Power Query Editor.
- Select the column or columns to check for duplicates by clicking the column header. Hold Ctrl to select multiple columns.
- Right-click the selected column header and choose Remove Duplicates, or go to Home tab and click Remove Rows, then Remove Duplicates.
- Click Close & Load to return the deduplicated data to Excel as a new table.
Advantages for large datasets
Power Query stores transformation steps in a query that refreshes when source data changes. This feature eliminates the need to repeat manual deduplication for recurring data imports. Power Query is standard in Excel 2016 and later versions, including Excel 365.
How to identify duplicates before removal using Conditional Formatting
To identify duplicates before removal using Conditional Formatting, apply the Duplicate Values rule to highlight matching cells. This method provides visual verification, allowing you to choose which row to keep before manual deletion.
Step-by-step process
- Select the range or column to check for duplicates.
- Go to Home tab, click Conditional Formatting, then select Highlight Cells Rules and choose Duplicate Values.
- Select a formatting style from the dropdown. The default highlights duplicates in light red with dark red text. Click OK.
- Review the highlighted cells, then manually delete duplicate rows by right-clicking and selecting Delete Row. This approach allows you to choose which specific row to keep rather than defaulting to the first occurrence.
Which method keeps the first occurrence automatically?
The Remove Duplicates tool and Power Query both keep the first occurrence automatically. Conditional Formatting requires manual selection of which row to retain.
| Method | Keeps First Occurrence | Manual Selection | Version Support |
|---|---|---|---|
| Remove Duplicates Tool | Yes (automatic) | No | Excel 2007+ |
| Power Query | Yes (automatic) | No | Excel 2016+ |
| Conditional Formatting | No | Yes | Excel 2007+ |
Which method should you use to keep one value?
The Remove Duplicates tool provides the fastest solution for keeping the first occurrence on small to medium datasets. Power Query suits large datasets requiring repeated deduplication or integration with data transformation workflows. Conditional Formatting works best when you need to choose which specific duplicate to keep rather than defaulting to the first occurrence.
| Scenario | Recommended Method |
|---|---|
| Quick deduplication, keep first occurrence | Remove Duplicates Tool |
| Large datasets with recurring updates | Power Query |
| Manual selection of which duplicate to keep | Conditional Formatting |
| Audit trail requirements | Power Query (preserves steps) |
. Was this Helpful?
Get Online Tutoring or Questions answered by Experts.
You can post a question for a tutor or set up a tutoring session
Answers · 1
What is the formula to highlight duplicate values
Answers · 1
What is the formula to remove duplicates
Answers · 1
How to delete duplicate values in excel
Answers · 1
How to delete duplicate rows based on one column
Answers · 1