HomeGoogle DocsSpreadsheetHow to Highlight Adjacent Duplicates in Google Sheets

How to Highlight Adjacent Duplicates in Google Sheets

Published on

In this post, let’s learn to highlight consecutive or adjacent duplicates in Google Sheets.

The conditional formatting for the same is simple.

Sometimes we may require to find duplicate values in rows or columns in consecutive cells, not in distant cells.

I’ve conditional format rules for the same for both row and column-wise data.

That will help you identify such values.

For example, we have the text “apple” in cells A2, A4, A5, and A7. The formula should only highlight A4 and A5 since those are the consecutive cells with duplicates.

You can also decide whether to conditional format both A4 and A5 or A5 alone, i.e., from the second occurrence onwards.

Here are examples of highlighting adjacent duplicates in Google Sheets.

Highlight Adjacent Duplicates Row or Column-Wise

In the first example, we will use a conditional format custom formula rule to highlight all the occurrences of duplicates in consecutive cells.

Later we can see how to exclude the first occurrence.

Highlight All the Occurrence of Consecutive Duplicate Cells

Please see the screenshot below.

Highlight All Adjacent Duplicates in Google Sheets
screenshot # 1

Column-Wise Data

We can use the following LEN and Logical AND based rule for the column-wise data in B2:I2.

=and(len(B2),B2=C2)

You must apply this twice, first for the range B2:I2 and then for the range C2:I2. Here is how?

Go to Format > Conditional formatting.

It will open the sidebar panel to enter the range of cells to highlight. Also, to add the above formula rule.

Find “Apply to range,” and enter B2:I2, which is the range to highlight for consecutive or adjacent duplicated cells.

Then select “Custom formula is” under “Format rules.”

Just enter the above formula and choose the color to fill the cells that contain the adjacent duplicate values.

Below that, find the option “Add another rule.”

Open that and modify “Apply to range” to C2:I2 and “DONE.”

Consecutive Duplicates in Google Sheets
screenshot # 2

Note:- To include another row, i.e., B3:I3, you are only required to modify the “Apply to ranges” B2:I2 and C2:I2 to B2:I3 and C2:I3, respectively.

Row-Wise Data

We can follow the above method when we want to highlight adjacent duplicates in rows in Google Sheets.

Please see the range B8:B15 on screenshot # 1 above.

We can use the following conditional format formula for B8:B15 and B9:B15 (twice as above)

=and(len(B8),B8=B9)

Note:- When you have one more column, i.e., C8:C15, just modify the “Apply to range” to B8:C15 and B9:C15.

Highlight Adjacent Duplicates Except for First Occurrence

Please see screenshot # 3 below.

Highlight Adjacent Duplicates Except for First Occurrence
screenshot # 3

You can see the difference!

The consecutive duplicate cells are highlighted, both in column-wise and row-wise data, except for the first occurrence.

We require to delete one rule to achieve this.

Horizontal Data:- Delete the rule added for B2:I2. We only require the C2:I2 one.

Vertical Data:- Delete the rule added for B8:B15. We only require the B9:B15 one.

This way we can highlight adjacent duplicates in Google Sheets.

That’s all. Thanks for the stay. Enjoy!

Resources

Prashanth KV
Prashanth KV
Your Trusted Google Sheets and Excel Guide Prashanth KV brings a wealth of experience in Google Sheets and Excel, cultivated through years of work with multinational corporations in Mumbai and Dubai. As a recognized Google Product Expert in Docs Editors, Prashanth shares his expertise through insightful blogging since 2012. Explore his blog for practical tips and guidance on maximizing your spreadsheet skills.

Running Total By Month in Excel

This tutorial demonstrates how to calculate the running total by month in a range...

SORT and SORTBY – Excel Vs Google Sheets

While Excel offers the SORT and SORTBY functions for sorting a table, Google Sheets...

Get Top N Values Using Excel’s FILTER Function

When using the FILTER function in Excel to extract the top N values, it's...

XLOOKUP in Excel: Working with Visible Rows in a Table

In Excel, the XLOOKUP function isn't inherently designed to exclusively work with visible rows;...

More like this

Interactive Random Task Assigner in Google Sheets

You have multiple tasks and multiple people. Here's a fun way to randomly assign...

Google Sheets Bar and Column Chart with Target Coloring

To color each data point in the column or bar chart according to the...

Analyzing Column A Between Non-Adjacent Values in Column B: Google Sheets

This tutorial addresses a common scenario encountered in Google Sheets: how to sum, average,...

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.