How to remove duplicate rows in Excel, Google Sheets and Notepad++

Three apps, four methods, and the one setting that silently deletes the wrong rows.

In Excel, select any cell in the range and go to Data → Remove Duplicates, then tick the columns that define a duplicate. In Google Sheets it is Data → Data cleanup → Remove duplicates. In Notepad++ install the TextFX plugin and use TextFX → TextFX Tools → Sort lines case sensitive and remove duplicates. All three keep the first occurrence and delete the rest.

Excel, step by step

  1. Click any cell inside your data. Excel expands the selection automatically, which is convenient and also the source of most accidents — check the highlighted range before you continue.
  2. Data tab → Remove Duplicates in the Data Tools group.
  3. Tick My data has headers if row 1 is a header, otherwise Excel treats it as data and may delete it.
  4. Tick only the columns that define a duplicate. Leaving every column ticked means a row is only removed when all values match — a different phone number on the same email survives.
  5. Press OK. Excel reports how many duplicates were removed and how many unique values remain.

This deletes rows in place and cannot be undone once the file is saved and closed. Copy the sheet first, or at minimum note the original row count.

Non-destructive alternative in Excel 365 and 2021: =UNIQUE(A2:A500) spills a clean list into a new column and updates when the source changes. To find duplicates without deleting anything, use conditional formatting: Home → Conditional Formatting → Highlight Cells Rules → Duplicate Values, or add a helper column with =COUNTIF($A$2:$A$500,A2)>1 and filter on TRUE.

Google Sheets

Select the range, then Data → Data cleanup → Remove duplicates. The dialog has the same two decisions: does the data have a header row, and which columns are compared. Sheets tells you afterwards how many duplicate rows were removed and how many remain.

The formula route is better if the source list keeps changing: =UNIQUE(A2:A) in an empty column gives a live deduplicated list. Combine it with =SORT(UNIQUE(A2:A)) to get a sorted one in a single formula. To count how often each value appears, =COUNTIF(A:A,A2) is the same as in Excel.

Data cleanup also has Trim whitespace right above it. Run that first. Leading and trailing spaces are the reason two visually identical entries are not treated as duplicates.

Notepad++ and plain text lists

For a list that is not in a spreadsheet — emails, URLs, keywords, log lines — Notepad++ has two routes.

Built in, no plugin: Edit → Line Operations → Remove Consecutive Duplicate Lines. The word consecutive is the catch: it only removes repeats that are next to each other, so sort the file first with Edit → Line Operations → Sort Lines Lexicographically Ascending.

With the TextFX plugin: select all, then TextFX → TextFX Tools → Sort lines case sensitive and remove duplicates. One step, but it sorts the list and you lose the original order. Install TextFX from Plugins → Plugins Admin; it is not bundled in 64-bit builds by default.

Regex route, keeps order, no plugin: Find & Replace, Regular expression mode, find ^(.*?)$\s+?^(?=.*^\1$) and replace with nothing. It is slow on files over a few thousand lines and it is easy to mistype. On the command line, awk '!a[$0]++' in.txt > out.txt does the same job, keeps order, and handles a million lines.

If you just want it done in the browser without installing a plugin or writing a regex, paste the list into a duplicate line remover — it keeps the first occurrence and preserves the original order, which is what the sort-based methods take away.

Which method for which job

MethodKeeps original orderDestructiveBest for
Excel Remove Duplicatesyesyesone-off cleanup of a table
Excel/Sheets UNIQUE()yesnoa list that keeps changing
Sheets Data cleanupyesyesquick table cleanup
Notepad++ TextFXno, sortsyeslarge plain-text lists offline
awk one-lineryesnofiles over 100,000 lines
Browser dedupe toolyesnoa list pasted from anywhere, nothing to install

What usually goes wrong

Cleaning a list properly, in order

The sequence matters more than the tool. Do it in this order and the deduplication step becomes trivial:

  1. Trim leading and trailing whitespace.
  2. Normalise case if case should not distinguish entries.
  3. Remove empty lines.
  4. Deduplicate.
  5. Sort if you need a browsable list, and only then — sorting first throws away the original order for nothing.

Record the count before and after. A 12,000-row export that drops to 11,940 is plausible; one that drops to 3,100 means your comparison column was the wrong one.

Related tools

How random is randomGood enough for a raffle, not good enough for a password. Here is the actual…Count words in Google DocsThe exact menu path in every app, and why two counters give you two different…Instagram caption lengthThe hard limit is 2,200 characters. The one that matters is the 125 you see…PDF text breaksThe file has no paragraphs to give you. Here is what it does have, and how to…Vowel counterCounts vowels, consonants, letters and digits in any text.Morse codeTurn text into dots and dashes, or decode Morse back to words. Everything runs…Character counterLive character count with and without spaces, plus common platform limits.

See all text tools →

Frequently asked questions

Where is Remove Duplicates in Excel?

On the Data tab, in the Data Tools group. Select a cell in the range first and check the range Excel highlights before pressing OK.

Does Excel Remove Duplicates ignore case?

Yes. Apple and apple are treated as the same value. Convert the column to a single case first if you need case to matter.

How do I remove duplicates without deleting rows?

Use =UNIQUE() in a new column, or highlight duplicates with Conditional Formatting and a COUNTIF helper column, then decide manually.

How do I dedupe a list in Notepad++?

Sort the lines first, then Edit, Line Operations, Remove Consecutive Duplicate Lines. The TextFX plugin does both in one step but always sorts.

Why are two identical-looking rows not removed?

Almost always a trailing space, a non-breaking space, or a look-alike letter from another alphabet. Trim and clean the text before deduplicating.

Can I undo Remove Duplicates?

Ctrl+Z works while the file is still open. Once saved and closed, the rows are gone, so copy the sheet before you start.