How to Find Duplicates in Google Sheets but Ignore Blank Cells: Highlight, Count, List and Remove Without Empty Rows Getting in the Way (2026)

The standard duplicate formulas in Google Sheets have one annoying habit: they treat empty cells as values. An empty cell matches every other empty cell, so a highlight rule colors the whole unused part of the column, a duplicate count comes out in the hundreds, UNIQUE returns a blank line, and Remove duplicates deletes rows just because their email cell is empty. This guide shows the small change that fixes each of these, how to deal with cells that only look empty, and what to do when the column you check is often blank.

The short answer

The example

A sign-up list. Most people left an email; some only left a phone number. Row 8 looks empty in column A but actually contains a single space, a common leftover from copy-pasting.

RowA: EmailB: NameC: Phone
2ana@example.comAna(blank)
3(blank)Ben555-0101
4cara@example.comCara555-0199
5(blank)Dev555-0102
6ANA@example.comAna R.(blank)
7(blank)Ben C.555-0101
8(one space)Eli555-0103
9cara@example.comCara555-0199

The real duplicates by email are Ana (rows 2 and 6; COUNTIF ignores letter case, so ANA@example.com matches) and Cara (rows 4 and 9). Rows 3, 5 and 7 have no email at all, and they aren’t duplicates of each other: they’re three different people.

Why blank cells show up as duplicates

The usual highlight rule is:

=COUNTIF($A$2:$A, A2)>1

For A3, the criterion is an empty cell, and COUNTIF counts the other empty cells in $A$2:$A as matches. On the example A3, A5 and A7 light up next to the real duplicates, and because the rule is applied to the open range A2:A, so does every empty cell below row 9. The same thing happens in a helper column (=COUNTIF($A$2:$A, A2) shows a large number on blank rows) and in any count built on it. The single space in A8 is unique, so it stays uncolored here, but keep it in mind; it comes back later.

Highlight duplicates but skip empty cells

  1. Select A2:A (the column without the header).
  2. Choose Format › Conditional formatting.
  3. Under Format rules, open Format cells if… and choose Custom formula is.
  4. Enter the formula below, pick a fill color under Formatting style, and click Done.
=AND(A2<>"", COUNTIF($A$2:$A, A2)>1)

A2<>"" is FALSE for an empty cell, so AND returns FALSE before the count matters. On the example only A2, A4, A6 and A9 are colored. To color the whole row instead, select A2:C and lock the column letters:

=AND($A2<>"", COUNTIF($A$2:$A, $A2)>1)

The cell in the formula (A2) must be the top-left cell of the range you selected, or the colors shift by a row. More rule variations, such as coloring only the second and later copies, are in the highlight duplicates guide. If you use a helper column instead of colors, the same idea is:

=IF(A2="", "", COUNTIF($A$2:$A, A2))

Cells that only look empty

Two kinds of cells cause trouble:

=AND(LEN(TRIM(A2))>0, COUNTIF($A$2:$A, A2)>1)

Zeros are values, not blanks: if your sheet uses 0 to mean “nothing”, add A2<>0 to the AND as well.

Counts, lists and filters without blanks

Every formula below skips empty cells. Results are for the example (column A, rows 2 to 9, with empty rows below):

GoalIgnores blanksOn the example
Highlight repeated emails=AND(A2<>"", COUNTIF($A$2:$A, A2)>1)A2, A4, A6, A9
Count rows that are duplicates=SUMPRODUCT((A2:A<>"")*(COUNTIF(A2:A, A2:A)>1))4
Count extra copies=ARRAYFORMULA(ROWS(TOCOL(A2:A, 1)) - ROWS(UNIQUE(LOWER(TOCOL(A2:A, 1)))))2
Each email once=UNIQUE(TOCOL(A2:A, 1))4 entries (ANA and the space are separate)
Repeated emails, once each=ARRAYFORMULA(LET(u, UNIQUE(LOWER(TOCOL(A2:A, 1))), FILTER(u, COUNTIF(A2:A, u)>1)))ana@example.com, cara@example.com
Show the duplicate rows=FILTER(A2:C, A2:A<>"", COUNTIF(A2:A, A2:A)>1)rows 2, 4, 6, 9

Count duplicates

To count the rows whose email appears more than once:

=SUMPRODUCT((A2:A<>"")*(COUNTIF(A2:A, A2:A)>1))

Without the (A2:A<>"") part, =SUMPRODUCT(--(COUNTIF(A2:A, A2:A)>1)) also counts every empty row in A2:A, so on a 1,000-row tab the answer is close to 1,000 instead of 4. For the number of extra copies (the rows Remove duplicates would delete), subtract the number of different values from the number of filled cells:

=ARRAYFORMULA(ROWS(TOCOL(A2:A, 1)) - ROWS(UNIQUE(LOWER(TOCOL(A2:A, 1)))))

Here 5 filled cells (including the space in A8) minus 3 different values gives 2: the ANA row and the second Cara row. TOCOL with 1 skips empty cells (Google’s TOCOL help), and LOWER is there because UNIQUE is case-sensitive while COUNTIF is not. Counting duplicates explains why different “how many duplicates” numbers disagree.

Get each value once, without the blank line

=UNIQUE(A2:A) returns 5 rows on the example: ana@example.com, an empty entry, cara@example.com, ANA@example.com and the space. Either of these drops the empty entry:

=UNIQUE(TOCOL(A2:A, 1))
=UNIQUE(FILTER(A2:A, A2:A<>""))

To also merge letter case and ignore cells that hold only spaces, which returns just ana@example.com and cara@example.com:

=ARRAYFORMULA(UNIQUE(LOWER(TRIM(FILTER(A2:A, LEN(TRIM(A2:A))>0)))))

Google’s UNIQUE help covers the function itself; UNIQUE vs Remove duplicates compares it with the menu tool.

List the repeated values, or show the duplicate rows

Each repeated email once:

=ARRAYFORMULA(LET(u, UNIQUE(LOWER(TOCOL(A2:A, 1))), FILTER(u, COUNTIF(A2:A, u)>1)))

Every row whose email is repeated (rows 2, 4, 6 and 9 on the example):

=FILTER(A2:C, A2:A<>"", COUNTIF(A2:A, A2:A)>1)

FILTER keeps a row only when all its conditions are TRUE, so A2:A<>"" keeps the blank rows out (Google’s FILTER help). More variations are in show only duplicates.

When the column you check is often blank

Ignoring blanks has a cost: rows without an email are never compared at all. In the example, Ben (row 3) and Ben C. (row 7) are probably the same person, because they left the same phone number, but the email check can’t see that. You have two options.

Only compare rows where every key column is filled

If a duplicate means “same name and same phone”, require both to be present. Applied to A2:C:

=AND($B2<>"", $C2<>"", COUNTIFS($B$2:$B, $B2, $C$2:$C, $C2)>1)

On the example only the two Cara rows match. Without $C2<>"", two rows with the same name and no phone would match each other through their empty phone cells. Google’s COUNTIFS help describes the range/criterion pairs, and duplicates across multiple columns covers multi-column checks in detail.

Fall back to another column

Often the better question is “same email, or same phone when there’s no email”. Build that key in a helper column D. Put this in D2 and fill it down:

=IF(LEN(TRIM(A2))>0, LOWER(TRIM(A2)), IF(LEN(TRIM(C2))>0, "tel:"&TRIM(C2), ""))

or fill the whole column from D2 at once:

=ARRAYFORMULA(IF(LEN(TRIM(A2:A))>0, LOWER(TRIM(A2:A)), IF(LEN(TRIM(C2:C))>0, "tel:"&TRIM(C2:C), "")))

The “tel:” prefix stops a phone number from ever matching an email, LEN(TRIM()) treats the space in A8 as empty, and a row with neither email nor phone gets an empty key. Then highlight rows with a repeated key (applied to A2:D):

=AND($D2<>"", COUNTIF($D$2:$D, $D2)>1)
RowNameD: KeyDuplicate?
2Anaana@example.comyes (row 6)
3Bentel:555-0101yes (row 7)
4Caracara@example.comyes (row 9)
5Devtel:555-0102no
6Ana R.ana@example.comyes (row 2)
7Ben C.tel:555-0101yes (row 3)
8Elitel:555-0103no
9Caracara@example.comyes (row 4)

Ben and Ben C. are now caught, and Dev and Eli are correctly left alone. Phone numbers typed in different formats (555-0101 vs 5550101) won’t match; duplicates that don’t match exactly shows how to normalize them.

Remove duplicates without deleting rows that have a blank

If you select A1:C9, choose Data › Data cleanup › Remove duplicates and tick only Email, the tool compares the empty email cells like any other value: row 3 is kept as the “first” blank and rows 5 (Dev) and 7 (Ben C.) are deleted along with the real duplicates in rows 6 and 9. Four rows remain, and two of the people you lost were never duplicates. Google’s Remove duplicates help describes the tool; the fix is to give each blank row a value nobody else has.

Option 1: a helper column, then Remove duplicates

  1. Right-click the tab and choose Duplicate, so you have a backup.
  2. Type a header such as Key in D1. In D2, enter the formula below and fill it down to the last row of data.
  3. Copy column D and paste it over itself with Edit › Paste special › Values only, so the helper values no longer change when rows are deleted.
  4. Select the table including the header and the helper column, choose Data › Data cleanup › Remove duplicates, tick Data has header row, and tick only the helper column. Click Remove duplicates.
  5. Delete the helper column.
=IF(LEN(TRIM(A2))>0, A2, "blank row "&ROW())

Each blank (or spaces-only) email becomes blank row 3, blank row 5 and so on, which never match each other. On the example rows 6 and 9 are removed and rows 2, 3, 4, 5, 7 and 8 stay. To also merge the Ben rows by phone, use the fallback key from the previous section as the helper instead.

Option 2: a cleaned copy with a formula

To leave the original alone, enter this on a new tab (copy the header row into row 1 and put the formula in A2):

=FILTER(A2:C, LEN(A2:A&B2:B&C2:C)>0, (LEN(TRIM(A2:A))=0)+(COUNTIFS(A2:A, A2:A, ROW(A2:A), "<="&ROW(A2:A))=1))

The first condition drops completely empty rows; the second keeps a row if its email is empty or if it’s the first time that email appears (the running COUNTIFS only looks at rows up to the current one). It returns the same six rows as Option 1 and updates as the list changes. To keep the newest row instead of the first, see keep the latest row; to run the cleanup on a schedule, see remove duplicates automatically.

Pitfalls

FAQ

Why does my duplicate highlight color empty cells?

Because an empty cell matches other empty cells. With a rule like =COUNTIF($A$2:$A, A2)>1, every blank cell in the range finds the other blanks, so the count is above 1 and the cell is colored, including all the unused rows below your data. Add a check that the cell isn’t empty: =AND(A2<>"", COUNTIF($A$2:$A, A2)>1).

How do I highlight duplicates in Google Sheets but ignore blanks?

Select the column without the header (for example A2:A), choose Format › Conditional formatting, choose Custom formula is and enter =AND(A2<>"", COUNTIF($A$2:$A, A2)>1). To color the whole row, select A2:C and use =AND($A2<>"", COUNTIF($A$2:$A, $A2)>1). If some “empty” cells contain spaces, use LEN(TRIM(A2))>0 instead of A2<>"".

How do I stop UNIQUE from returning a blank row?

Remove the blanks before UNIQUE sees them: =UNIQUE(TOCOL(A2:A, 1)), where the 1 tells TOCOL to skip empty cells, or =UNIQUE(FILTER(A2:A, A2:A<>"")). An open range like A2:A always contains empty rows, so =UNIQUE(A2:A) returns one empty entry.

Does Remove duplicates treat blank cells as duplicates?

A blank cell in a column you tick is compared like any other value, so if you tick only an Email column, every row with no email after the first one is removed, even though those rows are different people. Add a helper column that gives each blank row its own value, such as =IF(LEN(TRIM(A2))>0, A2, "blank row "&ROW()), paste it as values, and tick only that column in Data › Data cleanup › Remove duplicates.

Why do some empty-looking cells still count?

They aren’t empty. A cell with a space passes A2<>"", so two such cells match each other. Run Data › Data cleanup › Trim whitespace, or test LEN(TRIM(A2))>0 instead. A formula that returns "" is the opposite case: A2<>"" treats it as empty, but ISBLANK(A2) returns FALSE because the cell holds a formula, so prefer A2<>"" over ISBLANK.

How do I count duplicates without counting blanks?

To count the rows whose value appears more than once, use =SUMPRODUCT((A2:A<>"")*(COUNTIF(A2:A, A2:A)>1)). To count only the extra copies (the rows Remove duplicates would delete), use =ARRAYFORMULA(ROWS(TOCOL(A2:A, 1)) - ROWS(UNIQUE(LOWER(TOCOL(A2:A, 1))))). Both skip empty cells.

Duplicate rows without the formulas? SheetDupes (disclosure: we make it) is a Google Sheets add-on for duplicate rows. Tick the columns that define a duplicate in the sidebar, preview the matching groups, then highlight the extra rows without changing any values, and only then remove them or merge each group into one row. It copies a backup tab before it removes or merges anything, ignores extra spaces and, optionally, letter case and punctuation. Preview and Highlight are free on any size sheet; there is a 14-day free trial with no credit card, and writes remain free after the trial on sheets with up to 2,000 data rows during launch (through Jan 31, 2027; 500 after that). It only reads and writes the spreadsheet you have open, and your data is not sent to Loomwise. It is live on the Google Workspace Marketplace.
Install free from Google Workspace MarketplaceSee SheetDupes
Want to test it first? Try it on sample data (makes a copy of a 12-row example sheet in your Drive).

Related guides