You can make Google Sheets colour every cell whose value appears more than once in a column. You need one conditional formatting rule with a COUNTIF custom formula, and nothing gets deleted. If you actually want the repeats gone, use How to Remove Duplicates in Google Sheets instead.
The formula that flags repeated values
This is the example from Google's conditional formatting help page for data in A1 to A100:
=COUNTIF($A$1:$A$100,A1)>1
COUNTIF counts how many cells in $A$1:$A$100 match the value in A1. If the count is more than 1, the value is repeated and the cell gets your chosen format.
Steps to add the duplicates rule
These are the steps from Google's help page for the computer version of Sheets:
- Open your spreadsheet in Google Sheets on your computer.
- Select the range you want to check, for example A1 to A100.
- Click Format, then Conditional formatting. A toolbar opens on the right.
- Under the Format cells if drop-down, click Custom formula is. If a rule already exists, click it, or click Add new rule and then Custom formula is.
- Click Value or formula and enter
=COUNTIF($A$1:$A$100,A1)>1. - Under Formatting style, pick a fill or text colour.
- Click Done.
Write the formula for the first row of your selection. Google's page says to write the rule for the first row, and Sheets applies it down the rest of the range.
This rule highlights the first copy too
Google's example marks every occurrence of a repeated value, including the first one. That follows from how COUNTIF works: the count includes the cell itself. If "Smith" appears twice, both cells count 2, so both are coloured.
That is usually what you want when you are hunting for duplicates without deleting them. This article covers only highlighting every occurrence.
Why the dollar signs matter
Google's page notes that you often need dollar signs in front of column letters and row numbers so the rule uses absolute references instead of relative ones. In the duplicates formula the two parts behave differently:
$A$1:$A$100is locked. Every cell is checked against the same full range.A1has no dollar signs, so it is relative. It becomes A2 for the second row, A3 for the third, and so on.
This is the most common reason the rule misbehaves. If you leave out the dollar signs on the range, it shifts along with each row, so later cells are counted against a different slice of the column and the highlighting looks random. If you lock A1 as $A$1, every cell is compared with the first cell's value. Keep the range locked and the single cell relative.
For a different column, change the letters to match. For data in C2 to C500, for example, select that range and use $C$2:$C$500 as the range and C2 as the cell.
When the highlighting looks wrong
Another rule wins. Google's page says rules are evaluated in the order listed, and the first rule found true sets the cell's format. If an older rule covers the same cells, drag the duplicates rule above it in the Conditional formatting toolbar.
Colours turn up where you didn't add a rule. Copying and pasting from a cell or range that has formatting rules also applies those rules to the pasted data, per Google. Open Format > Conditional formatting on the affected cells to see which rules came along.
Wildcards don't match. According to Google, the ?, * and ~ wildcards work only with the "Text contains" and "Text does not contain" conditions, not in custom formulas.
You want to remove the rule. In the Conditional formatting toolbar, point to the rule and click Remove.
Limits and what isn't covered
These steps follow the computer version of the page. Google publishes a separate Android version, and the menus may differ in the mobile apps.
Google's page says custom formulas can only reference the same sheet. This article doesn't cover rules that check data on another sheet.