Yes. In Microsoft Excel for Microsoft 365, Remove Duplicates keeps the first matching row in the current top-to-bottom order and removes later rows that match the columns you choose. It does not decide which entry is newest or most complete, so sort the records first if you want a particular one to survive.
What “first” means in Excel
Excel checks the rows in the selected range from top to bottom. When it encounters a row whose selected values have already appeared, it treats that row as a duplicate and removes it. The first row with that combination of values stays; later matching rows go. “First” therefore means first in the order the records have at the time you run the command, not first by date added, original creation time, or any other hidden ranking.
For example, if a customer list has two records for ID 104, with the older record above the newer one, Remove Duplicates keeps the older record unless you reorder the list first. The command does not compare other fields to decide which record is better. If the first record has a blank email and the later duplicate has a complete email, Excel will not merge the two or fill in the blank; it keeps the first row and removes the later one.
Excel reports how many duplicate values it found and how many unique values remain after the operation. That summary is useful as a quick check, but it does not replace reviewing the data or keeping a backup when the rows matter.
How the selected columns define a duplicate
The columns checked in the Remove Duplicates dialog define what Excel considers a match. If you check every column, two rows must match across all those checked columns to count as duplicates. If you check only Customer ID, rows with the same ID count as duplicates even if their names, dates, or addresses differ. Excel then removes later matching rows from the selected data range; it does not simply clear the repeated ID cell.
Suppose the rows are “104, Lee, North” and “104, Lee, South.” If you check only the ID column, Excel keeps the first row and removes the second. If you check ID and Name, the rows still match, so the second is removed. If you check ID, Name, and Region, those two rows are distinct because their regions differ. This makes the column choices a practical decision about what makes a record unique, not just a technical setting.
Excel looks for matching values in the columns you selected; it does not recognize that “Jon Smith” and “Jonathan Smith” might be the same person, or that an address written with different abbreviations might refer to the same place. The command is not fuzzy matching. Extra spaces, inconsistent punctuation, spelling variations, and inconsistent data types can prevent records that look similar to a person from matching exactly. Standardize the relevant fields first if those differences should not matter.
Remove duplicates without losing the wrong row
On Windows, select the full data range or click inside the Excel table, then choose Data > Remove Duplicates. Review the column list before confirming; do not assume Excel has chosen the key fields you intend. A typical safe sequence is:
- Make a copy of the worksheet or workbook if you may need to restore the original records.
- Select the complete table or range, including every field that belongs to each record.
- Choose Data > Remove Duplicates.
- If the first row contains headings, confirm that My data has headers is selected. Otherwise, Excel may treat the headings as ordinary data.
- Check only the columns that define a duplicate for your task. Select all columns if only fully identical rows should be removed.
- Choose OK, read the results message, and inspect the remaining records.
For Excel for Microsoft 365 on Mac, use the Data tab’s Remove Duplicates command and review the dialog’s header and column options; the ribbon layout can differ slightly from Windows. Excel for the web also has data-cleaning controls, but the available layout and options can vary. If you cannot see the command or need to control the exact range, open the workbook in the desktop app.
Selecting the complete dataset is important. If you select just one column while related fields sit outside the selection, you risk removing or changing values without treating the records as complete rows. Using an Excel table or selecting the whole rectangular data range helps keep each person’s or transaction’s fields together.
Choose which copy to keep by sorting first
Because Excel keeps the first matching row, sorting is how you control which duplicate remains. Sort the entire dataset—not just one column—so the values in each record stay together. For example, to keep the latest transaction for each order ID, sort the date column newest to oldest, then remove duplicates using Order ID as the only checked column. The latest row for each ID will be first in its group and will be retained.
Likewise, to preserve the most complete record, add or use a completeness indicator, sort complete records above incomplete ones, and then remove duplicates using the identifier that defines a match. If records can tie on the sorting field, decide how to break the tie with another field; otherwise, whichever tied record appears first will survive. Sorting does not combine information from duplicate rows, so copy or reconcile useful fields before deleting any row that contains unique details.
To make the process predictable, you can also sort by the key column first so matching records sit together, then sort within each group by the field that determines priority. Be sure the sort covers all columns in the table or range. Sorting only the ID column would detach IDs from their associated names and other data.
Common problems and how to avoid them
- Excel removed records that were not identical across the whole sheet. Check the dialog’s selected columns. If only ID was checked, different rows with the same ID were expected to count as duplicates.
- Records that look alike were not removed. Check for leading or trailing spaces, different spellings, punctuation, and inconsistent representations. Clean or standardize the key fields, then run the command again on a copy.
- A heading was treated as a record. Use the header option correctly. A misspelled or missing heading can also make it harder to tell which field is selected in the dialog.
- The wrong duplicate survived. The row that appeared first in the current order was retained. Undo the operation if possible, sort the complete records to put the preferred copy first, and repeat.
- Some rows were missed. Confirm that the selected range includes all intended records and that the key columns are included. Blank rows, separate blocks of data, or records outside the selection may require handling separately.
Do not assume that different formatting makes values different, or that matching-looking text always has identical underlying content. For dates, numbers, and imported data, check both the stored values and how they are represented before deduplicating. If a field is an identifier, it is often safer to keep it consistently as text or consistently as a number rather than mixing formats.
Is Remove Duplicates reversible?
Immediately after running the command, you can usually undo it with Ctrl+Z on Windows or Command+Z on Mac. Undo is a short-term recovery option, not a substitute for a backup: later actions, closing the file, or other changes can affect what you can undo. Make a copy first when removing records could have significant consequences. If you discover an error right away, undo before making additional edits.
Remove Duplicates is a destructive cleanup operation on the selected data: it removes later rows from that range rather than merely hiding them. If you want to audit which entries would be removed, flag them with a helper formula or use conditional formatting and inspect the results before deleting anything. This is especially useful for customer, inventory, or financial records where two rows with the same key may still contain different information worth preserving.
Alternatives when you want to keep the source data
For a separate list of unique full rows, Excel 2021 and Microsoft 365 support the dynamic-array function UNIQUE. With the complete records in A2:C100, enter =UNIQUE(A2:C100) in an empty cell. Excel returns one copy of each distinct row in the output area and leaves the source range unchanged. This compares the combinations across all three columns; it does not choose a preferred row based on a date or merge fields.
To identify later repeats by a single key before taking action, use a helper column. With IDs in A2:A6, enter this formula in B2 and fill it down through B6: =COUNTIF($A$2:A2,A2)>1. For IDs 104, 107, 104, 109, 107, it returns FALSE, FALSE, TRUE, FALSE, TRUE. TRUE marks each occurrence after the first. You can filter that helper column to review the rows before deleting them. COUNTIF is not case-sensitive, so it is not suitable if uppercase and lowercase spellings must be treated as different identifiers.
UNIQUE is useful when you need a refreshed distinct output rather than deleting rows, while Remove Duplicates is appropriate when you intend to clean the original range. A helper column is useful when you want to inspect or document the rows marked for removal. Choose based on whether you need a permanent cleanup, a live result, or a review step.
Frequently Asked Questions
Does Excel Remove Duplicates keep the first or last row?
It keeps the first matching row in the current top-to-bottom order and removes later matches. To keep what is currently the last copy, sort or rearrange the data so that copy comes first before running the command.
Does Remove Duplicates delete an entire row?
It removes duplicate records from the selected range, not just the repeated value in the checked column. Select the full dataset so related fields stay together and the operation applies to the records you intend.
Can I remove duplicates based on one column but keep the other columns?
Yes. Select the full dataset, then check only the key column in the dialog. Excel keeps the first full row for each key and removes later rows with that key, even if their other fields differ.
How do I keep the newest duplicate in Excel?
Sort the complete dataset by its date field from newest to oldest, then run Remove Duplicates using the identifier column as the key. The newest row appears first within each matching group and is kept.
Does Excel distinguish uppercase and lowercase duplicates?
Remove Duplicates treats text matches without regard to letter case, so values such as ABC and abc are treated as duplicates for this purpose. If case differences are meaningful in your data, use a case-sensitive review method rather than relying on this command.
Related
- Conditional Formatting in Spreadsheets: How It Works
- AG Grid Hide Column: APIs, Menus, and Visibility Rules
- AG Grid Insert Row: APIs, Examples, and Row Model Tips
Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.
More in How-to basics
- How to Compare Documents in Microsoft WordTo compare two versions in Microsoft Word, open Word and choose Review > Compare > Compare on Windows.…
- Open a ZIP File in Excel: Extract and Import DataYou can’t open a ZIP archive directly in Excel. First extract its contents with File Explorer, then open…
- How to Double Space Text in Microsoft Word Step by StepTo double-space text in Microsoft Word, select the text—or press Ctrl+A on Windows or Command+A on Mac to…
- How to Remove Page Break View in Excel: Normal ViewTo remove Page Break Preview in Excel for Microsoft 365 on Windows, select View > Normal. If you…
- How to Make Columns in Word 365To make columns in Word for Microsoft 365 on Windows, select the text you want to format, then…
- How to Archive a Lot of Emails in Outlook at OnceTo archive a large batch in Outlook, narrow the message list with a search or folder filter, select…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.