How to Find and Remove Duplicate Rows Based on Multiple Columns

To find duplicate rows based on specific columns rather than whole rows, use COUNTIFS with one pair of arguments per column you care about: =COUNTIFS(A$2:A$100, A2, B$2:B$100, B2) returns how many rows share both values. Anything above 1 is a duplicate on those columns, even if other columns differ. Excel’s built-in Remove Duplicates does the same comparison but deletes immediately, so flagging first is safer.

Excel’s built-in “Remove Duplicates” feature works fine when duplicates are obvious: identical rows in every column. But what about when you need to find duplicates based on specific columns only? An order might appear twice with the same customer and date but different notes. A contact list might have the same person with slightly different phone numbers. Here’s how to find and handle duplicates based on the columns that actually matter.

Sample order data with partial duplicates

ABCD
1CustomerDateAmountNotes
2Acme Corp3/15/2026$1,200Initial order
3Bright LLC3/16/2026$850Rush delivery
4Acme Corp3/15/2026$1,200Duplicate entry
5Chen Inc3/17/2026$2,400Standard
6Bright LLC3/16/2026$900Corrected amount

Rows 2 and 4 are duplicates based on Customer + Date + Amount. Rows 3 and 6 match on Customer + Date but have different amounts. That might be a correction, not a true duplicate. The right approach depends on which columns you consider.

Method 1: COUNTIFS Formula to Flag Duplicates

Add a helper column that counts how many times each combination of Customer + Date appears:

=COUNTIFS(A$2:A$100, A2, B$2:B$100, B2)

Counts rows where both the Customer AND the Date match the current row. Any result greater than 1 means it’s a duplicate.

Wrap it in an IF for a clear flag:

=IF(COUNTIFS(A$2:A$100, A2, B$2:B$100, B2) > 1, "Duplicate", "Unique")

What the COUNTIFS duplicate flag returns

ABCE
1CustomerDateAmountStatus
2Acme Corp3/15/2026$1,200Duplicate
3Bright LLC3/16/2026$850Duplicate
4Acme Corp3/15/2026$1,200Duplicate
5Chen Inc3/17/2026$2,400Unique
6Bright LLC3/16/2026$900Duplicate

Adding more criteria

To check Customer + Date + Amount, just add another criteria pair: =COUNTIFS(A$2:A$100, A2, B$2:B$100, B2, C$2:C$100, C2). Now rows 3 and 6 would be flagged as unique since their amounts differ.

Method 2: Concatenation Key for Easy Filtering

Create a unique key by combining the columns you care about, then use COUNTIF on that key. The key goes in column E here; if column E already holds Method 1’s flags, use a free column and change E in the formula to match:

Step 1: Create a key column

=A2&"|"&TEXT(B2,"YYYY-MM-DD")&"|"&C2

Creates a key like “Acme Corp|2026-03-15|1200”. The TEXT function ensures dates compare consistently.

Step 2: Flag first occurrence vs duplicates

=IF(COUNTIF(E$2:E2, E2) = 1, "Keep", "Remove")

The range starts at E$2 and grows as it copies down. The first time a key appears, it’s “Keep”. Every subsequent occurrence is “Remove”. This lets you keep one copy and delete the rest.

Method 3: Built-In Remove Duplicates

For a quick cleanup when you just want to delete duplicates:

1Select your data range (including headers). If you added a flag or key column (Methods 1 and 2), include it and leave its box unchecked in step 3, so the flags stay with their rows.

2Go to Data → Remove Duplicates

3Uncheck columns you don’t want to compare: this is the key step. Leave only the columns that define a “duplicate” checked.

4Click OK. Excel deletes duplicate rows and tells you how many were removed.

Destructive and unforgiving

Remove Duplicates deletes rows permanently with no undo after you save. Always work on a copy of your data. Also, it keeps the first occurrence and deletes later ones. If the later row is the corrected version, you’ll lose the correction.

Conditional Formatting to Highlight Duplicates Visually

To highlight duplicates without modifying data:

1Select column A

2Home → Conditional Formatting → Highlight Cells Rules → Duplicate Values

For multi-column duplicates, add a helper key column first (Method 2) and apply the conditional formatting to that column.

Common questions

Can I undo Remove Duplicates?

Ctrl+Z works immediately afterwards, but not once the file is saved and closed. Flag duplicates with a formula first, review them, then delete.

Is duplicate matching case sensitive?

No. Both COUNTIFS and the built-in Remove Duplicates treat “Acme” and “ACME” as the same value.

Which duplicate does Excel keep?

The first occurrence in the current sort order, and it discards the rest. So sort deliberately before running it, because which row survives depends entirely on that order.

Deduplicating a real file, not a sample?

COUNTIFS flags duplicates well on a few hundred rows. On a full export it becomes a judgment call on every match: which record is the one to keep, and what do you do when two rows differ only by a trailing space.

Excel Data Cleaner standardizes the fields first so near-duplicates actually match, then shows you each duplicate group and lets you choose what survives before anything is deleted. Free up to 100 records per file.

Headed for a CRM? Add-on exporters turn the cleaned list into an import-ready file for HubSpot, Salesforce, Zoho, Pipedrive or monday.

See Excel Data Cleaner

Windows PC required: it runs inside Excel on Windows, not on a phone, a tablet or a Mac. Why it does not run on Mac.

Watch it done, 2:48. The same person three times in a contact list: the emails cleaned first so the copies match, then each group reviewed and one row kept, in Excel Data Cleaner.

When Formulas Aren’t Enough

Finding duplicates in a small dataset is straightforward. Real-world deduplication gets complicated fast:

  • Fuzzy duplicates: “Acme Corp” and “Acme Corporation” are the same company but won’t match with COUNTIFS
  • Keep the best record: when duplicates exist, you need to keep the one with the most recent date or highest amount, not just the first occurrence
  • Cross-file deduplication: finding duplicates across multiple source files before merging
  • Audit trail: logging which records were flagged as duplicates and why
  • Recurring imports: running deduplication every time new data arrives

A custom VBA deduplication tool handles fuzzy matching, smart retention rules, cross-file comparison, and detailed logging, all with one click.

★★★★★

“David does phenomenal work. We brought him in during the middle of a project and he was able to pick up a significant workload very quickly.”

Report Creation Client · Upwork

Deduplicating Thousands of Records Manually?

Tell us about your data and we’ll build a tool that handles it automatically.

Small fixes start at $69.

Every project gets a fixed-price quote before any work starts: the price you approve is the price you pay.

Step 1 of 2

What can we help you with?

A few words is enough. You can add more once we reply.

Pick the closest match (optional)

Helpful to include:

  • What you do today
  • What you want it to do instead
  • Anything you have already tried

Have a sample workbook or a screenshot? Attach it when you reply to our first email. A copy with confidential data removed is fine.

When do you need it?
Do you use Excel on Windows or Mac? (optional)

One more short step: your name and email.

Scroll to Top