Formula example

Find Duplicates in Excel

You want to flag duplicate SKUs in column A before importing or looking up product data.

Copyable formula

Excel and Google Sheets formula
=IF(A2="", "", IF(COUNTIF($A$2:$A$100, A2)>1, "Duplicate", ""))

Useful variations

Flag second and later duplicates only
=IF(A2="", "", IF(COUNTIF($A$2:A2, A2)>1, "Duplicate", ""))

This version leaves the first occurrence blank and flags repeat rows only.

Sample data

SKUItemCategoryPrice
A-100KeyboardHardware49
A-101MouseHardware25
B-200Desk MatOffice18
B-201NotebookOffice7

Formula explanation

  • COUNTIF counts how many times the current value appears in the full SKU range.
  • Values with a count greater than 1 are flagged as Duplicate.
  • The outer IF keeps blank rows from being marked as duplicates.
  • The absolute range keeps the check stable when filling the formula down.

Common errors

  • Forgetting absolute references can shift the count range while filling down.
  • Leading or trailing spaces can hide duplicates.
  • Use the second formula if you only want to flag duplicates after the first occurrence.

Build your own version

Use the deterministic builder for this pattern: Duplicate Checker Formula Builder.

Related formulas

FAQ

Can I flag only the second duplicate?

Yes. Use COUNTIF($A$2:A2,A2)>1 to flag repeats after the first occurrence.

Does this work in Google Sheets?

Yes. COUNTIF and IF use the same basic syntax here.