How to Remove Duplicate Lines in Excel

Published February 2025

By Anthony, founder of WordText.tools and web developer at Antomic Tech

Duplicate data is one of the most common problems in spreadsheet work. Merging lists from multiple sources, importing data that overlaps with existing records, or copying and pasting without checking for overlap all create duplicates. Excel has built-in tools for handling this, but they are slower and more cumbersome than necessary for simple text-based deduplication. Here are the Excel methods and a faster alternative for plain text lists.

Excel's Remove Duplicates Feature

The fastest built-in method is the Remove Duplicates button on the Data tab. Select your data range, click Remove Duplicates, choose which columns to compare, and click OK. Excel removes duplicate rows and tells you how many were deleted and how many unique values remain. The operation is permanent and cannot be undone with Ctrl+Z in older Excel versions, so work on a copy of your data.

This method compares entire rows by default. If two rows have identical values in every selected column, one is removed. You can select a subset of columns for comparison, which is useful when you want to deduplicate based on email address alone while keeping the first occurrence with its associated name and other data.

The limitation is that you have no control over which duplicate is kept. Excel keeps the first occurrence and removes subsequent ones. If the second occurrence has better data in other columns, you lose it. For cases where you need to choose which duplicate to keep, conditional formatting to highlight duplicates first gives you a chance to review before deleting.

Conditional Formatting to Highlight Duplicates

Select the range you want to check. Go to Home, Conditional Formatting, Highlight Cells Rules, Duplicate Values. Excel highlights all cells that appear more than once in the selected range. This does not remove anything. It shows you where duplicates exist so you can review them and decide which to keep.

This method works on a single column at a time. If you need to find duplicate rows based on a combination of columns, you need to create a helper column that concatenates the values you want to compare. Something like =A2&"|"&B2&"|"&C2 in a new column, then apply conditional formatting to that helper column. It works but it is clunky for what should be a simple operation.

UNIQUE Function (Excel 365 and Later)

If you have Excel 365 or Excel 2021, the UNIQUE function extracts unique values from a range into a new location. =UNIQUE(A2:A100) returns a dynamic array of unique values from column A. The result updates automatically when the source data changes, making it a non-destructive approach. Your original data stays intact and the deduplicated list exists separately.

UNIQUE can also work across multiple columns: =UNIQUE(A2:C100) returns unique rows based on all three columns. The function accepts an optional parameter to return values that appear exactly once rather than all unique values, which is useful for finding entries that exist in one list but not another.

The downside is that UNIQUE is only available in newer Excel versions. If you are working with Excel 2016 or earlier, or sharing files with people who use older versions, the function will not work and the cells will show a #NAME? error.

The Faster Alternative for Text Lists

For plain text lists where you do not need Excel's row-and-column structure, the duplicate remover on this site is significantly faster. Paste your list in, click the button, and get deduplicated output instantly. No need to open Excel, set up a spreadsheet, select ranges, or navigate ribbon menus.

I use this tool instead of Excel whenever the data is a simple list: email addresses, product codes, names, URLs, tags, or any single-column data. The tool handles lists of any size, preserves the original order, and tells you how many duplicates were found. The entire process takes about five seconds compared to the minimum of 30 seconds to a minute that Excel requires just to open and set up.

The tool also catches duplicates that Excel might miss if your data has hidden whitespace. A line with a trailing space and the same line without one are technically different strings. Excel treats them as different values. The solution is to clean whitespace first using the whitespace remover, then run the deduplication. This two-step process catches every duplicate regardless of hidden formatting differences.

Preventing Duplicates

The best approach to duplicates is preventing them in the first place. Excel's Data Validation feature can restrict a column to unique values, showing an error message when someone enters a duplicate. Set this up on columns that should contain unique identifiers like email addresses, product codes, or account numbers.

For data imports, deduplicate the incoming data before importing rather than after. It is easier to clean a list of 500 new entries than to deduplicate against an existing database of 50,000 records. Run new data through a deduplication step as part of your import workflow and you avoid the problem entirely.

When merging data from multiple sources, establish a primary key that uniquely identifies each record. Compare incoming records against existing ones using that key. This is standard practice in database management but often overlooked in spreadsheet-based workflows where people merge data by copying and pasting entire sheets together.