Excel Command to Remove Duplicates: Steps and Tips

How-to basics · Updated November 18, 2026

In Excel for Microsoft 365 on Windows, select your data and choose Data > Remove Duplicates. In the dialog box, select the columns that define a duplicate, confirm whether your data has headers, and click OK; Excel keeps the first matching row and removes later matches.

Where to find the Remove Duplicates command

The command is on Excel’s Data tab, in the Data Tools group. It works on a selected range or an Excel table. Before running it, make sure you have selected the whole dataset, including every column that should stay together. Removing duplicates from only one column in a multi-column list can leave related values out of alignment if you have not selected the entire records.

  1. Click a cell in your dataset, or select the complete range of records and columns.
  2. Choose Data > Remove Duplicates.
  3. If the first row contains field names, check My data has headers. Otherwise, leave it unchecked.
  4. In the column list, check the fields Excel should compare to decide whether rows are duplicates.
  5. Click OK and read the message reporting how many duplicate values were removed and how many unique values remain.

In Excel for Mac, use the Data tab and choose Remove Duplicates; the dialog and choices are substantially the same. On Mac, undo with Command+Z; on Windows, use Ctrl+Z. Excel for the web also offers duplicate removal from the Data tab, although ribbon layout can vary with the available window space.

What Excel considers a duplicate

Excel compares the values in the columns you select in the dialog. If you select just Email, two rows with the same email address count as duplicates even if their names or departments differ. If you select Name, Email, and Department, Excel removes a later row only when the values match across all three selected fields. A difference in any selected field means the rows are not duplicates for that operation.

This distinction matters because a duplicate row is not always the same thing as a repeated value. A customer may appear more than once because they have multiple orders; removing rows based only on the customer name would discard legitimate order records. Decide whether your goal is to remove repeated records or to keep only one row per value in a particular field, then select columns accordingly.

Excel keeps the first occurrence it encounters in the selected data and removes later matching rows. Therefore, the row that remains may not be the one with the newest date, most complete details, or highest priority. If you want a particular record to survive, sort the data appropriately before removing duplicates, or use another method that lets you review which record to keep.

Choosing the right columns: a practical example

Imagine a contact list with columns for Name, Email, and City. Two rows contain “Mina Patel,” the same email address, and different cities because Mina moved. If you select all three columns, Excel keeps both rows because City differs. If an email address is your unique identifier and you want one row per address, select only Email in the Remove Duplicates dialog. Excel then keeps the first matching email row and removes later ones, taking their associated name and city values with them.

For an order table with Order ID, Product, and Quantity, selecting all columns removes only fully repeated records. Selecting Order ID alone keeps one row per order ID, even if the product or quantity differs between rows. That could conceal a data error rather than fix it. A good rule is to select every field that must match for a record to count as an exact duplicate, but only the identifier fields when the intended rule is one record per identifier.

  • Exact repeated rows: select all columns in the record.
  • One row per email address: select Email only, if email is the identifier you trust.
  • One row per combination: select the fields that form the key, such as Customer ID and Invoice Date.

Headers, tables, blanks, and data preparation

The My data has headers option tells Excel that the top row contains labels such as Name or Order ID, rather than records to compare. When checked, Excel displays those labels in the column list and does not treat the header row as a record. Verify the option before confirming: treating a real header as data can produce confusing results, while marking the first record as a header can exclude it from comparison.

Remove Duplicates deletes entire rows from the selected data, not just the repeated cell contents. When you work in an Excel table, its rows remain structured as table records, and the command can be used from the Data tab. For an ordinary range, include all relevant columns in your selection so neighboring data is not left behind. If the dataset has unrelated information next to it, do not select a larger area indiscriminately.

Blank cells can affect the comparison. For example, if you select one column containing several blank entries, Excel can treat repeated blank values as duplicates and remove later rows with blanks in that field. In a multi-column comparison, the combination of values across selected fields matters. Inspect blanks before deleting anything, especially if an empty cell means “unknown” rather than “the same value.”

Values that look alike may not be identical in the way your data was prepared. Extra spaces, inconsistent punctuation, or different spellings can prevent records from matching as expected. Conversely, text differences such as capitalization are not a dependable way to preserve otherwise matching entries as distinct records. If capitalization or exact text formatting is important to your rules, review the data first and use a deliberate comparison method rather than assuming the command will enforce that distinction.

Protecting data before you remove rows

Remove Duplicates changes the selected data immediately. It is often reversible right after the operation, but it is not a review-only tool: Excel does not ask you to approve each individual row that will be deleted. Keep a copy of the original list when the data is valuable, when the selection rules are uncertain, or when you may need to explain later why a record was removed.

  • Save a copy of the workbook, or duplicate the worksheet before making a significant cleanup.
  • Check that the selected range includes all fields belonging to each record.
  • Confirm the header setting and column checkboxes in the dialog.
  • Sort first if you need the newest, oldest, or otherwise preferred row to be the one that remains.
  • After removal, review the result and the count in Excel’s confirmation message.

If the result is wrong and you have not performed other actions since, use Ctrl+Z on Windows or Command+Z on Mac. Undo is most useful immediately after the command; do not rely on it as your only backup. The command is not a substitute for retaining the source data when deletion could have business or research consequences.

Common problems and how to resolve them

Excel removed too many rows. You may have selected too few comparison columns. Undo, reopen the command, and include the fields needed to distinguish legitimate records. If the rows have already been saved or the undo history is no longer available, restore the original copy if you made one.

Excel removed no rows. Check whether the selected columns contain small inconsistencies, such as extra spaces or different punctuation. Also confirm that the intended fields were checked. Two rows that appear identical on screen can differ in an unselected or hidden part of the data, while rows that differ in a selected field will not match.

The wrong version of a record remains. The command keeps the first occurrence; it does not choose the newest or most complete record automatically. Sort before deduplication when that sorting rule is appropriate, and verify the result. For more complex decisions, create a review process rather than deleting rows based on a simple match.

Only one column was cleaned, but the rest of the row stayed put. That usually means the operation was applied to a single-column selection rather than the full records. Undo if possible and repeat on the entire dataset, selecting the appropriate comparison columns in the dialog. The rows should be treated as records that move or disappear together.

Remove Duplicates compared with other Excel options

Remove Duplicates is the direct choice when you want to delete repeated entries from the current dataset. Conditional Formatting is safer for inspection: use Home > Conditional Formatting > Highlight Cells Rules > Duplicate Values to mark repeated values without deleting rows. Highlighting is useful before cleanup, but a rule applied to one column does not necessarily identify duplicate whole records.

For a separate, dynamic list of distinct values, Microsoft 365 and Excel 2021 include the UNIQUE function. For example, with product names in A2:A100, =UNIQUE(A2:A100) returns a spilled list of distinct values without deleting the source. This is different from Remove Duplicates: the original list stays intact, and the result can update as the source changes. UNIQUE is suitable for extracting distinct values, but it does not by itself decide which complete row to keep based on a custom preference.

Another option is Data > Advanced in the Sort & Filter group, where the Advanced Filter can copy unique records to another location. That can be useful when you want a separate result rather than modifying the source. For repeatable imports and larger cleanup workflows, Power Query also has a Remove Duplicates action after data is loaded into the editor. Those alternatives take more setup, but they can preserve a source list or make a recurring process easier to refresh.

Frequently Asked Questions

What is the shortcut to remove duplicates in Excel?
There is no need to memorize a dedicated shortcut: use Data > Remove Duplicates. Windows ribbon key sequences can depend on the current interface and key tips, so the visible command is the clearest route. On Mac, use the Data tab command as well.

Does Remove Duplicates keep the first or last row?
It keeps the first occurrence in the selected data and removes later rows that match the selected comparison columns. Sort the records first if a specific row should be first, and check the final result.

Can I remove duplicates based on just one column?
Yes. In the dialog, select only that column as the comparison field. Excel will remove later rows with a matching value in that field, including their other cell values, so make sure one row per value is actually what you want.

Does Remove Duplicates delete the entire row?
It removes duplicate records from the selected range or table, not merely the repeated value in one cell. Select the full set of columns that belongs to each record to avoid separating related information.

Can I find duplicates without deleting them?
Yes. Use Conditional Formatting to highlight duplicate values for review, or create a separate distinct-value list with UNIQUE in Microsoft 365 or Excel 2021. These methods let you inspect or preserve the source data.

Can I undo Remove Duplicates?
Usually, you can immediately undo it with Ctrl+Z on Windows or Command+Z on Mac. Because undo history can be affected by subsequent actions, save a copy before important cleanup and do not treat undo as a long-term backup.

Related

Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.

More in How-to basics

Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources

Spotted an error in this guide? Let us know.