New Tool Radar

AI for Data & Spreadsheets

How to Flag Duplicates With a COUNTIF Helper Column in Excel

Add a COUNTIF helper column that flags each repeated value, so you can review duplicates without deleting anything.

Schematic with three steps: Add a count column; Add a flag for repeats; Flag only the second and later copies.

Sometimes the safest clean-up deletes nothing: a helper column that counts how many times each value appears lets you filter, sort and review the repeats first. It is the non-destructive alternative to Remove Duplicates, and it stays in the sheet as a record of what was checked.

What you need

  • Excel with the column to check
  • An empty helper column beside the data
  • A note of which column is the key

Step 1: Add a count column

In the helper column, enter =COUNTIF($B$2:$B$30,B2), adjusted to your key column and rows, and fill it down. Each row now shows how many times its key value appears in the column.

Step 2: Add a flag for repeats

In a second helper column, enter =IF(COUNTIF($B$2:$B$30,B2)>1,’Duplicate’,”) and fill it down. Filter that column by Duplicate to see only the repeated rows.

Step 3: Flag only the second and later copies

To keep the first occurrence clean, use an expanding range instead: =IF(COUNTIF($B$2:B2,B2)>1,’Repeat’,”). Filter by Repeat and delete only those rows, after reading them.

Worked example: synthetic 15-row code list

The table below is a synthetic example. It shows the expected result of flagging duplicates; no workbook was opened.

Code Times listed Flag
A-101 1
B-205 2 Duplicate
C-310 1
B-205 2 Repeat

Expected result (UNTESTED). B-205 appears twice and is flagged Duplicate on both rows and Repeat on the second one; the other codes appear once and are unflagged. Only the Repeat row is a candidate for deletion. This check was not run live; the table shows the expected result for the synthetic example.

Limits

  • COUNTIF compares values case-insensitively, so Lena and LENA count as the same value.
  • A value with a trailing space counts as different; trim the key column first.
  • The helper column must be excluded from the range when you later run Remove Duplicates.

Sources

See all