How to Delete Duplicate Lines in Excel

How-to basics · Updated November 20, 2026

To delete duplicate lines (rows) in Excel for Microsoft 365 on Windows, select a cell in your complete data range, choose Data > Remove Duplicates, select the columns that define a duplicate, and click OK. Excel keeps the first matching row and removes later copies, so make a copy of important data first and check which columns are selected before confirming.

Removing duplicates is useful for cleaning contact lists, product records, survey results, and other tables where repeated entries can distort a count or report. The key decision is what should count as a duplicate: every value in a row, or only the values in particular columns. Excel can use either rule, but it removes whole rows from the selected range, so prepare and select the data carefully.

What You’ll Need

  • An Excel workbook containing the list you want to clean. The instructions below are for Microsoft Excel for Microsoft 365 on Windows.
  • A clear decision about which columns identify a duplicate. For example, two records might be duplicates when their email addresses match, even if their names or phone numbers differ.
  • A backup or a saved copy if the data is important. Remove Duplicates changes the worksheet, although you can usually reverse it immediately with Undo.
  • A simple, continuous data range with one header row is easiest to process. If your data is separated into unrelated blocks, work on each block separately.

Step-by-Step

  1. Save a copy or prepare to undo. If the list is important, use File > Save As to create a working copy before removing anything. Alternatively, make sure you can use Undo immediately if the result is wrong. Once you have made further changes or closed the workbook, recovering the original rows may be harder.
  2. Check the layout of your data. Make sure each record is on one row, each type of information has its own column, and the first row contains clear headings such as Name, Email, or Order ID. Remove completely empty rows within the list if they make it hard to identify the data range. Do not include a report title or notes above the column headings in the range you plan to clean.
  3. Select the complete range, including every column that belongs to each record. You can click a cell inside a continuous list and let Excel detect the range, or drag across the full table, from the first heading through the last row and column. If Excel asks whether to expand the selection, choose the option that includes the adjacent data. This keeps each remaining record together; selecting only one key column can leave related information untouched or out of alignment.
  4. Open the duplicate-removal dialog. On the ribbon, select Data > Remove Duplicates. Excel opens a dialog listing the columns in the selected range. If your selection includes headings, turn on My data has headers so Excel treats the top row as labels rather than as a record. Check that the headings shown in the list match your columns.
  5. Choose what defines a duplicate. To remove only identical full rows, leave every data column checked. Excel will consider rows duplicates when the values match across all of those checked columns. To identify duplicates using one or a few fields, click Unselect All, then check only the relevant columns. For example, select Email to keep one row per email address, or select Product ID and Store to keep one record for each product-store combination. Unchecked columns do not affect the matching decision, but Excel still removes the entire later row from the selected range.
  6. Review the options before confirming. Verify that My data has headers is set correctly and that the right identifying columns are checked. Think about which record should be kept: Excel retains the first matching row in the current order and removes later matches. If you want a particular record to remain, sort the data into the desired order before using this command.
  7. Remove the duplicates and check the result. Click OK. Excel displays a message reporting how many duplicate values were found and how many unique values remain. Read the message, then inspect the list to make sure the right row was kept and that related columns stayed together. If the result is not what you wanted, press Ctrl+Z on Windows immediately, review your selection and column choices, and run the command again.

The same general workflow is available in Excel for Mac: select the data and use Data > Remove Duplicates; the dialog may look slightly different. In Excel for the web, look for Remove Duplicates on the Data tab. If a command is not visible in a compact ribbon, expand the ribbon or use the app’s command search. The important checks remain the same: include the full record range and choose the correct matching columns.

Common Mistakes

  • Checking the wrong columns. Leaving every column checked finds only rows that match across the entire row. That will not remove records with the same email but different phone numbers. Conversely, checking only a broad field such as City may treat many legitimate records as duplicates.
  • Selecting only the column used to spot duplicates. If the rest of the record is not included in the selected range, the operation may not remove the corresponding whole records as intended. Select the complete table, then use the dialog to choose the columns that define a match.
  • Misreading the header setting. If a header row is included but My data has headers is off, Excel may treat a heading as data. If the range has no headers but the box is on, the first real record may be treated as a heading and skipped.
  • Assuming Excel chooses the best record. It does not compare which row has the most complete details or the newest date. It keeps the first match based on the current row order. Sort deliberately if one version should take priority.
  • Expecting matching appearance to mean matching contents. Two cells can look the same while containing different values, such as a number stored as text or a value with extra spaces. Conversely, different formatting alone does not necessarily make two underlying values distinct.

Tips

  • Choose a reliable identifier. An email address, account number, or product ID is often a better duplicate key than a person’s name, which may be shared by different people or written in different ways. For compound identification, check every field needed to distinguish a record, such as both Order ID and Item ID.
  • Sort to control which version stays. If you want to keep the most recent entry, sort the date column from newest to oldest before removing duplicates. If completeness matters, review or sort the data so the preferred record appears first. Confirm that sorting applies to the entire range, not just one column.
  • Preview potential duplicates first. If you are unsure what the right key is, use Home > Conditional Formatting > Highlight Cells Rules to highlight repeated values in a key column, or sort that column and inspect matching groups. A preview helps reveal cases where two records share a value but should remain separate.
  • Keep the source data when the decision needs review. Duplicate removal is permanent once you save and move on. Work on a copied sheet or workbook if you may need to compare the cleaned list with the original, explain which records were removed, or change your matching rule later.
  • Be consistent about data cleanup. Trim accidental spaces and standardize entries such as phone numbers or product codes before comparing them. Do not alter identifiers blindly: leading zeros can be meaningful, and converting a code to a number may change how it is stored or displayed.

Troubleshooting

Excel removes too few rows. Check whether all columns are selected. If they are, a small difference in any checked field means the rows are not considered duplicates. If matching one identifier is your goal, uncheck unrelated fields. Also inspect spaces, punctuation, and number-versus-text differences in the key values. Excel’s displayed text may hide a difference in the stored content.

Excel removes too many rows. You may have selected a column that is not unique enough, such as Last Name or City. Undo the operation with Ctrl+Z on Windows, then rerun it with a more specific key or a combination of columns. For example, matching on both Name and Date of Birth can be safer than matching on Name alone, though you should choose fields appropriate to your own records.

The wrong copy remains. Undo, sort the complete data range so the row you want to keep appears first, then run Remove Duplicates again. Check the sort order and ensure all columns move together. If ties remain—for example, two rows have the same date—inspect the tied records and decide which should be first before removing duplicates.

The command is unavailable or the range looks wrong. Confirm that you are editing a worksheet and that the intended data is selected. If the data is in a filtered list, consider clearing the filter so you can review all records; do not assume hidden rows are excluded from the cleanup. Expand the ribbon if needed, and make sure you have selected the full range rather than a chart or unrelated object. If Excel’s automatically detected range stops early, select the intended cells manually.

The result count seems unexpected. The dialog’s report is based on the chosen range and checked columns, not on what looks similar to a person. Recheck the header option, the first and last rows, and the checked-column list. Then inspect a few examples of records you expected to match. If the source contains formulas, compare their displayed results and underlying values; formulas that return the same text may still be affected by differences in other selected columns.

Frequently Asked Questions

Does Remove Duplicates keep the first or last row?
It keeps the first matching row in the current order and removes subsequent matches. Sort the entire range first if a specific version should be retained.

Can I remove duplicates based on just one column?
Yes. Select the full range, open Data > Remove Duplicates, and check only that column. Excel uses that field to identify matches but removes the later matching rows from the selected range.

Can I remove only exact duplicate rows?
Yes. Include the full table and leave all relevant columns checked. A row counts as a duplicate only when its values match across the checked columns.

Will this delete the whole worksheet row?
Remove Duplicates removes duplicate records from the selected data range, not unrelated information elsewhere on the worksheet. Include every column that belongs to the records you are cleaning, and avoid placing unrelated data immediately beside the list if Excel might include it in the selection.

Can I undo duplicate removal?
Usually, yes: use Ctrl+Z on Windows immediately after the command. On Mac, use Command+Z. Undo may no longer be available after closing the workbook or continuing through actions that clear the undo history, so save a backup for important data.

Does Remove Duplicates distinguish uppercase and lowercase?
For ordinary text comparisons, capitalization alone generally does not make otherwise identical entries distinct. If capitalization is part of the identifier in your workflow, check your data separately before removing rows, rather than relying on this command to preserve case-only differences.

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.