How to Highlight Duplicates in Google Sheets: Conditional Formatting Formulas for One Column, Whole Rows, Repeats Only and Two Sheets (2026)
Coloring duplicates is the safe first step before you delete anything: you can see every repeat in place, check whether it is a real duplicate, and decide what to do with it. Google Sheets has no one-click “highlight duplicates” rule, but a custom formula in conditional formatting does the job in under a minute. This guide gives the formula for each common case and explains the two mistakes that make the wrong cells light up.
The basic rule: highlight duplicates in one column
- Select the column, for example click the A column header (or select
A1:A). - Choose Format › Conditional formatting.
- Under Format rules, open Format cells if… and choose Custom formula is.
- Enter the formula below, pick a fill color under Formatting style, and click Done.
=COUNTIF($A:$A,$A1)>1
Conditional formatting evaluates the formula once for every cell in the range, as if you had written it in the top-left cell and filled it down. COUNTIF($A:$A,$A1) counts how many cells in column A hold the same value as the current cell; anything above 1 is a duplicate, so every copy, including the first, is colored. The $ before A locks the column; the 1 without a $ lets the row move as the rule walks down the column.
Ignore blank cells. On a column with gaps, empty cells can be treated as duplicates of each other. Add a not-blank check to be safe:
=AND($A1<>"",COUNTIF($A:$A,$A1)>1)
Have a header row? Apply the rule to A2:A and write the formula for row 2: =AND($A2<>"",COUNTIF($A$2:$A,$A2)>1). Why the row number must change is covered under pitfalls below.
Highlight the whole row when several columns repeat
Often a duplicate is a combination: the same first name and last name, or the same email and date. To color the entire row, apply the rule to the whole table (for example A2:D) and use COUNTIFS with one range/criterion pair per key column:
=AND($A2<>"",COUNTIFS($A$2:$A,$A2,$B$2:$B,$B2)>1)
Every column reference has a $ in front of the letter. That is what makes the whole row light up: cells in columns C and D still check columns A and B of their own row. Without the $, the rule in column C would compare columns C and D instead.
Helper-column alternative. With many key columns, or if you also want to filter on the result, build a key in a spare column. In E2:
=A2&"|"&B2&"|"&C2
Fill it down, then apply the rule to A2:E with =AND($A2<>"",COUNTIF($E$2:$E,$E2)>1). Keep the separator: without it, ab + c and a + bc both become abc and count as a match. The blank check is on $A2, not the key, because an empty row still produces a key of ||, and all empty rows would match each other.
Highlight only the second and later copies
To leave the first occurrence plain and color only the repeats, so the color marks exactly the rows you would delete, use a range that starts at a fixed first row and ends at the current row:
=AND($A1<>"",COUNTIF($A$1:$A1,$A1)>1)
On row 5, the range is $A$1:$A5: only the rows above plus the current one. The first copy counts 1 and stays plain; the second copy counts 2 and is colored. For whole rows, use the same pattern in COUNTIFS: =AND($A2<>"",COUNTIFS($A$2:$A2,$A2,$B$2:$B2,$B2)>1) applied to A2:D. Which copy counts as “first” depends on the current sort order, so sort first if, for example, you want to keep the newest row.
Case-sensitive duplicates
COUNTIF and COUNTIFS ignore letter case, so Anna and ANNA are a match. Usually that is what you want. When case matters, for example product codes where ab12 and AB12 are different items, compare with EXACT inside SUMPRODUCT:
=AND($A1<>"",SUMPRODUCT(--EXACT($A$1:$A,$A1))>1)
EXACT returns TRUE only for an identical match, including case; -- turns TRUE/FALSE into 1/0 and SUMPRODUCT adds them up. For second-and-later copies only, shrink the range the same way: =AND($A1<>"",SUMPRODUCT(--EXACT($A$1:$A1,$A1))>1). The opposite problem, values that should match but don’t because of extra spaces or formatting, is covered in duplicates that don’t match exactly.
Highlight duplicates across two sheets
A conditional formatting formula can only refer to its own tab directly; Google’s help says to use INDIRECT to reference another sheet, because it takes the reference as text. To color values on the current tab that also appear in column A of a tab named Sheet2:
=AND($A1<>"",COUNTIF(INDIRECT("Sheet2!A:A"),$A1)>0)
Note the >0: one match on the other tab is enough. If the tab name has spaces, wrap it in single quotes inside the text: INDIRECT("'Client list'!A:A"). Because the reference is text, renaming the tab breaks the rule silently, so update the formula if you rename. To check the other direction, add the mirror rule on the second tab. For values in a different spreadsheet file, conditional formatting cannot reach it at all; bring the column in with IMPORTRANGE on a helper tab first. Comparing two columns or two sheets covers that in more detail.
Common pitfalls (why the wrong cells light up)
- The row in the formula doesn’t match the first row of the range. This is the most common mistake. If Apply to range is
A2:A1000but the formula says$A1, every cell checks the row above it, so the highlight lands one row below the real duplicates (and blank rows can light up). Always write the formula for the top-left cell of the range. - Missing
$on the counted range.COUNTIF($A2:$A,$A2)without$before the2makes the range start at the current row as the rule moves down, so it only looks downward and the last copy of each value is never highlighted. Lock it:$A$2:$A. - Missing
$before the column letter in a whole-row rule. Each column then checks itself instead of the key column, giving a patchy, half-colored row. - Values that look the same but aren’t. A trailing space, a non-breaking space pasted from the web, or an ID kept as text
00123next to the number123will not match. Clean the column first (TRIM, one consistent format). - Wildcards.
COUNTIFtreats*and?in the value as wildcards, so a code likeA*1also matchesAB1. Use theEXACTrule for codes that contain them. - Rule order. When several rules cover the same cell, the first matching rule in the sidebar wins. Drag the duplicates rule to the top if another rule hides it.
- Speed. A rule that scans a whole column for every cell slows down on tens of thousands of rows. Limit the range (for example
A2:A5000) on large sheets.
How to remove the highlight
Select a cell in the range, choose Format › Conditional formatting, hover over the rule in the sidebar and click the trash icon. The colors disappear and no values are changed. To keep the rule but stop it covering some cells, edit Apply to range instead. Deleting the duplicate rows themselves is a separate step: see how to find and remove duplicates, which covers Data › Data cleanup › Remove duplicates and keeping the right row.
FAQ
Does Google Sheets have a built-in highlight duplicates option?
No. Conditional formatting has no preset rule for duplicates, so you choose Custom formula is and enter a COUNTIF formula such as =COUNTIF($A:$A,$A1)>1.
Why are the wrong cells highlighted?
The row number in the formula must match the first row of the Apply to range. If the range starts at A2, write the formula for row 2 ($A2), not row 1. Also lock the column with $ and lock the start of the counted range ($A$2).
How do I highlight only the second and later copies?
Use a range that grows down the column: =COUNTIF($A$1:$A1,$A1)>1. The first copy counts 1 and stays plain; every later copy counts 2 or more and is highlighted.
Is COUNTIF case-sensitive?
No. COUNTIF treats Anna and ANNA as the same. For a case-sensitive rule use =AND($A1<>"",SUMPRODUCT(--EXACT($A$1:$A,$A1))>1).
How do I highlight duplicates between two sheets?
Conditional formatting cannot refer to another sheet directly, so wrap the reference in INDIRECT: =AND($A1<>"",COUNTIF(INDIRECT("Sheet2!A:A"),$A1)>0). Put the sheet name in single quotes inside the text if it contains spaces.
How do I remove the highlighting?
Open Format › Conditional formatting, hover over the rule and click the trash icon. The highlight goes away; your data is not changed.
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
- How to Find and Remove Duplicates in Google Sheets: Highlight, Count, Delete and Keep the Original (2026)
- How to Compare Two Columns or Two Sheets in Google Sheets to Find Matches and Duplicates (2026)
- Duplicates That Don’t Match Exactly in Google Sheets: Case, Extra Spaces, Gmail Dots, Phone Formats and Typos (2026)
- How to Remove Duplicates in Google Sheets but Keep the Latest, First or Highest Row per Key (2026)
- How to Prevent Duplicate Entries in Google Sheets: Data Validation Rules, Warnings and a Small Script (2026)
- How to Count Duplicates in Google Sheets: per Value, Extra Rows, Unique Counts and Why the Numbers Disagree (2026)
- How to Combine Two Lists or Several Tabs in Google Sheets Without Duplicates: VSTACK, UNIQUE, One Row per Key and Other Files (2026)
- How to Merge Duplicate Rows in Google Sheets: Sum the Numbers, Join the Notes and Fill the Blanks (2026)
- UNIQUE vs Remove Duplicates in Google Sheets: Live or Static, Letter Case, Spaces, Columns and Headers (2026)
- How to Remove Duplicates Within a Cell in Google Sheets: Comma-Separated Lists, Tags, Line Breaks and Letter Case (2026)
- How to Show Only the Duplicates in Google Sheets: Filter Duplicate Rows, List Repeated Values and Find Rows That Appear Once (2026)
- How to Find Duplicates Across Multiple Columns in Google Sheets: Rows That Match on Two or More Columns, and Values Repeated Anywhere in a Range (2026)
- How to Remove Duplicates Automatically in Google Sheets: Apps Script on a Daily Timer, on Form Submit or From a Menu (2026)
- How to Find Duplicates in Google Sheets but Ignore Blank Cells: Highlight, Count, List and Remove Without Empty Rows Getting in the Way (2026)
- How to Find Duplicate Transactions in Google Sheets: Double-Imported Rows, Invoices Paid Twice and Same-Amount Charges Within a Few Days (2026)
- How to Format Phone Numbers in Google Sheets: Strip Dashes and Spaces, Show (555) 010-1234, Handle +1 and Extensions, Then Find Duplicate Contacts (2026)
- How to Change Text Case in Google Sheets: UPPERCASE, lowercase, Proper Case Names, Sentence Case and Duplicates That Differ Only in Case (2026)
- Highlight overdue tasks in Google Sheets
Instructions refer to Google Sheets as it worked on November 17, 2026; menu names can change. Google Sheets is a trademark of Google LLC and this site is not affiliated with Google. Questions or corrections: hello@loomwise.app.