How to Highlight Duplicates In Google Sheets (Easy Steps)

Watch Video – Highlight Duplicates in Google Sheets

You can highlight duplicates in Google Sheets in a number of different ways, but the simplest is to use a custom formula in the conditional formatting menu:

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

If this is a little confusing, don’t worry, we’ll show you in detail how to do this, as well as a few other methods in this comprehensive guide. Read on to learn more.

Highlight Duplicates in Google Sheets

  1. Select the range.
  2. Go to Format > Conditional formatting
  3. Click +Add a rule
  4. Set “Format cells if…” to “Custom formula is” and enter the duplicate check formula =COUNTIF($A$2:$A$15,A2)>1”
  5. Click Done.

Download Our Example Spreadsheet

You can make a copy of our Example Sheet to follow along with this tutorial. The spreadsheet has 2 sheet tabs for the two examples used in this guide.

Master Google Sheets in No Time

Highlighting duplicates with conditional formatting can be a little intimidating for a new user. If you’re having trouble, we recommend taking a full Google Sheets crash course to sharpen your skills.

Highlight Duplicates in Google Sheets in a Single Column

Suppose you have a dataset as shown below, and you want to highlight all the duplicate data in column A.

Dataset which has duplicates

To highlight duplicates with conditional formatting, follow these steps.

  1. Select the range. In the example case, we want to use A2:A15 (image 1, box).
    Select the dataset
  2. Go to Format >Conditional formatting.
    click on conditional formatting
  3. Click on the “+ Add another rule” option in the conditional formatting pane that opens. If it’s already open you’ll find this option below the existing rules.
    Click on Another rule
  4. Set “Format cells if…” to “Custom formula is” and enter the duplicate check formula “=COUNTIF(Range,Criteria)>1” In this case, we’re using the formula =COUNTIF($A$2:$A$15,A2)>1
    Add the formula in conditional formatting to highlight duplicates
  5. Click Done.

Google Sheets is now highlighting duplicates in our grocery list.

Duplicates highlighted in a column

Note that using this method highlights all the instances of the duplicate cell. So if an item repeats twice or thrice, all the cells that have this item/text will be highlighted.

The COUNTIF function used in conditional formatting counts how many times a cell text string appears in the list. If it’s more than 1, the formula returns TRUE and those cells are highlighted.

Note: Use the “Formatting style” section to change the highlighting color and font style. This is very helpful if you need to highlight more than one fill color at a time.

Untitled

Highlight Duplicates in Multiple Google Sheets Columns

When working with larger spreadsheets with many columns, you will likely want to highlight the entire column when there’s a duplicate instead of just the cell.

This makes it easier to have Google Sheets find duplicates when the duplicated cell isn’t on the screen.

This process differs in two ways:

  • The range needs to include all rows (A2:A15 is now A2:F15).
  • The criteria section needs to use an absolute value for the column (A2 is now $A2).

Let’s use our grocery list from before, but now we’ve added where you find each product in the store as a new column (as shown below).

Dataset with duplicate rows

Follow these steps to highlight the entire row for duplicate cells in one column:

  1. Select the range of all columns and rows you want to highlight. In the example, select A2:B15 instead of A2:A15
    Select the dataset with duplicate rows
  2. Open the “Conditional Formatting” feature and check the new range (image 2, top box).
  3. In the “Conditional Formatting” tab, set the “Format rules” to “Custom formula is…”
  4. Enter the duplicate-finding formula with the criteria adjusted for an absolute column. This means adding a dollar sign “$” before “A2” in our example. So “=COUNTIF($A$2:$A$15,A2)>1” is now “=COUNTIF($A$2:$A$15,$A2)>1”.
Conditional formatting for multiple rows duplicate highlight
  1. Hit “Done” to apply the new formatting (image 2, bottom box).

Now we’ve highlighted the entire row range for columns with duplicates.

Entire duplicate record is highlighted

Highlight the Entire Row if Duplicates Are in One Column

Let’s say we wanted to highlight an entire row if there are duplicates in column B. In our example below, we could apply the following formula to the conditional formatting menu to achieve this:

=COUNTIF($B$2:$B$7,$B2)>1

Conditional formatting a row

This indicates the conditional formatting should highlight the entire row if Google Sheets shows duplicates in the range $B$2:$B$7.

Highlight Duplicates But Ignore the First Instance

As I mentioned earlier, when you use conditional formatting to highlight duplicates in Google Sheets, it will highlight all the instances of duplicate cells.

But what if you want to highlight only the duplicate instances (and not the first time it appears in the list).

You can adjust the formula so Google Sheets will only highlight the second or later instance of a duplicate by making a tweak to the formula.

Suppose you have the dataset as shown below and you want to highlight only the cells that have the duplicate item.

Dataset with duplicate rows

We need to make a tweak to our old “=COUNTIF($A$2:$A$15,$A2)>1” formula (this is the one we used in the previous section).

  • Adjust the ending range value from $A$15 to $A2. Now that we’ve set the column to absolute in the ending, but now the row, each row will only look at rows above itself for duplicates.
  • Our new formula will look like this:
    =COUNTIF($A$2:$A2,$A2)>1
Highlight only the duplicate instance

In our example, this change to the formula (arrow) now only highlights the second instance in which our duplicates appear (box).

Highlight Complete Row Duplicates in Google Sheets

Now instead, let’s pretend you only want to highlight the row if every column in the table is a complete match. We can do this by using the ARRAYFORMULA function to concatenate the data into one string before applying the COUNTIF function.

This will apply Google Sheets conditional formatting for duplicates to the appropriate cells.

We used the following formula in the example below to get the desired results. You just have to change the cell references to match your table.

=COUNTIF(ArrayFormula($A$2:$A$9&$B$2:$B$9&$C$2:$C$9),$A2&$B2&$C2)>1

Highlighting duplicates that are the same for an entire row

A Shortcut to Remove All Duplicates

Google Sheets has a handy tool for removing duplicates instead of highlighting them.

We’ll use our grocery list with product location data from before to show how it works.

Here’s how to find duplicates in Google Sheets with this tool:

Dataset with duplicate rows
  1. Select the cell range you want to analyze.
  2. Open the “Data” menu.
  3.  Go to Data Cleanup > “Remove Duplicates”.

 

 Go to Data Cleanup > “Remove Duplicates”.
  1. From the “Remove duplicates” pop-up.
  2. check “Data has header row” if the data has this feature
  3. Choose the columns you want to check for duplicate values from the checklist. In our example, we only want to compare column A values.
  4. Choose “Remove duplicates” to apply the change.
    Remove duplicate dialog box

The spreadsheet now only has rows without duplicate cells from our selection.

List without duplicates

Google Sheets conditional formatting duplicates by highlighting also helps to show duplicates in Google Sheets so that you can remove the ones you don’t need at your own discretion.

Highlight Exact Duplicates – 2nd, 3rd, etc Instances

It is also possible to use conditional formatting to highlight specific instances of the duplicated word. Let’s say in our example below, we want to highlight the items that appear more than once without highlighting the first instance they appear.

Dataset with duplicates

We would:

  1. Select our range
  2. Go to Format > Conditional formatting
  3. Click +Add a rule
  4. Set “Format cells if…” to “Custom formula is” and enter the duplicate check formula =COUNTIF(ArrayFormula($A$2:$A2&$B$2:$B2),$A2&$B2)>1
  5. Choose a color scheme, then click Done.

With that formula, we will have our duplicates highlighted only from the second instances going forward like below.

Highlighted duplicates

Highlight Duplicates with Added Criteria

Google Sheets can check for conditional highlighting with additional criteria. You can set the program to highlight only rows with duplicate data in multiple columns or only duplicates with specific values.

The formula needs to use the “*” (and) operator to apply both conditions. An example formula to find duplicates in Google Sheets with more criteria would look like this:

=(COUNTIF(Range,Criteria)>1) * (New Condition) )

For example, we can have our grocery list examples from before only highlight duplicate products that are fruits or vegetables. We don’t care about products that appear twice in the bakery or any of the aisles.

Our spreadsheet now features lists all the different fruits and vegetables available at the store:

Dataset highlight duplicates added criteria

In our example, we want to highlight the values in columns C and D if a row value appears twice in column C and at all in columns A and B.

Our formula construction will look like this:

  • Start with our old formula, now modified to check column C instead of A: =COUNTIF($C$2:$C$15,$C2)>1
  • Wrap the formula in parenthesis to add the second condition: =(COUNTIF($C$2:$C$15,$C2)>1))
  • Add the “and/*” operator and the second set of parentheses for the second condition:
  • =(COUNTIF($C$2:$C$15,$C2)>1)*())
  • Our second condition checks if the match appears in columns A and B, so it will look a little different. Instead of checking for “greater than 1” it will check for “greater than 0” and look like this: COUNTIF($A$2:$B$15,$C2)>0
  • Our new formula will look like this:

=(COUNTIF($C$2:$C$15,$C2)>1)*(COUNTIF($A$2:$B$15,$C2)>0)

Applying the new range and new formula to our data range will highlight all the fruits and vegetables that are duplicates. It will not highlight the bagels which appear twice because they aren’t in the fruits or vegetable columns.

Highlight duplicates with added condition

Some Tips When Highlighting Duplicates in Google Sheets

Here are some things to keep in mind when working on highlighting duplicates in Google Sheets:

How to Edit, Add or Delete Conditional Formatting Rules

To remove or edit conditional formatting rules, you simply have to:

  1. Click any cell that formatting is currently applied to
  2. Navigate to Format > Conditional formatting
  3. Click the rule in the menu to make changes or click the trash icon to delete
Edit conditional formatting rules

Create a Unique Cells List (Instead of highlighting duplicates)

Sometimes going through the process of highlighting data to find duplicate rows isn’t the fastest way to find out what you’re looking for.

If you just want to come up with a list of unique values to visualize how many duplicates you’re working with, the Unique function might be right for you.

To use this feature: enter “=unique(range start: range end)” in the cell you want to be at the top of your list.

Unique formula

In this grocery list example, we are entering “=unique(A2:A15)” at cell B2. When applied, it filters out the duplicates and populates all the cells below it necessary to come up with a unique values list.

Unique list

Trim Whitespace to Curate Data

It’s common to encounter extra spaces before and after data when you’re importing information into Google Sheets from other sources.

For example, an email might come in as both “me@mysite.tld” and “me@mysite.tld “ with a space at the end of the second version. These are duplicates but won’t show up as such because that empty space confuses Google Sheets.

You can trim whitespace from your data with the following:

  • Select the data you want to trim (left bßox).
  • Open the “Data” drop menu (arrow).
  • Choose “Trim whitespace” from the list.
Trim whitespaces

If the selected data has any invisible whitespaces, Google Sheets will remove them. The data won’t look any different to you, but it is now different for data analysis.

Frequently Asked Questions

Can Google Sheets Highlight Duplicates?

Yes, here’s how to identify duplicates in Google Sheets:

  1. Highlight the range you wish to check for duplicates
  2. Navigate to Format > Conditional formatting
  3. Apply a COUNTIF formula after selecting Custom formula is from the rule menu.

What Is the Formula to Highlight Duplicates in Google Sheets?

You should combine the COUNTIF formula with the Conditional formatting menu to highlight duplicates.

How Do I Find Duplicates in Two Columns in Google Sheets?

You have to use absolute values as the cell references in the Custom formula inside the Conditional formatting menu. Here’s an example of how to check for duplicates in Google Sheets across two columns.

Conditional-formatting-for-multiple-rows-duplicate-highlight

How Do I Count Duplicates Only in Google Sheets?

To count duplicates only in google sheets, you need to create a custom formula to count duplicates in the conditional formatting rule.

  1. Select our range
  2. Go to Format > Conditional formatting
  3. Click +Add a rule
  4. Set “Format cells if…” to “Custom formula is” and enter the formula =COUNTIF($A$2:$A2,$A2)>1
  5. Click Done.

How Do I Compare Different Google Spreadsheets for Duplicates?

To highlight duplicate cells across sheets, you have to use a complex formula such as this one:

“=AND(A2=INDIRECT(“Sheet1!A2:A”),B2=INDIRECT(“Sheet1!B2:B”), C2=INDIRECT(“Sheet1!C2:C”))”

We have a full guide on finding duplicates across sheets on our sister site.

Is It Possible to Exclude Blanks for Duplicate Highlights in the Same Row?

Yes, you can use a combination of the AND function and COUNTIFS to exclude spaces with a formula similar to this one:

=AND(COUNTIFS(B:B,B1)>1,B1″”)

The AND function here ensures the cells are only counted if there is a duplicate and they are non-blank cells  indicated by the “”.

Wrapping Up

Highlighting duplicates in Google Sheets is a valuable tool for making information easier for people to understand.

There is an immense range of customization options to highlight duplicates in Google Sheets with multiple conditions.

I hope this tutorial helped you better understand how to use this useful feature! You can also check out our guide to Google Sheets data validation.

Want to become a Google Sheets expert? We highly recommend checking out Udemy’s Google Sheets Comprehensive Masterclass and the Complete Google Sheets Course.

Related:

Spreadsheet Expert at Productivity Spot

Sumit is a Google Sheets and Microsoft Excel Expert. He provides spreadsheet training to corporates and has been awarded the prestigious Excel MVP award by Microsoft for his contributions in sharing his Excel knowledge and helping people.

Popular Posts

2 thoughts on “How to Highlight Duplicates In Google Sheets (Easy Steps)”

  1. Awesome article! Now, every time I input a “new” item it will tell me if I have it already or not! Amazing! Thank you!

  2. I’m trying to copy what you’re doing here to find duplicates in a column. Why did you use A2 as your criteria and why did you use all those $ signs?

    Thanks.

Comments are closed.