Highlight duplicates only if consecutive cells

GenericEric

New Member
Joined
Apr 16, 2015
Messages
22
Hi everyone,
Is there a way of only highlighting duplicate cells if they are consecutive (ie touching each other) in Excel 2010?

so if A1 says "Dog" A2 says "Dog" A3 says "Cat" and A4 says "Dog" A5 says "Cat" A6 says "Cat" it would highlight A1,A2, A5 and A6

Bit stumped here
 
Hi

Something like this?

Excel 2013
AB
1HeaderResult
2dogTRUE
3dogTRUE
4catFALSE
5dogFALSE
6catTRUE
7catTRUE
8catTRUE
9dogFALSE
10catFALSE
11dogFALSE
12catTRUE
13catTRUE
14dogTRUE
15dogTRUE
Sheet1
Cell Formulas
RangeFormula
B2=COUNTIF(A1:A3,A2)>1


You can also use this rule in conditional formatting.
 
Upvote 0
Hi

Something like this?
Excel 2013
AB
HeaderResult
dog
dog
cat
dog
cat
cat
cat
dog
cat
dog
cat
cat
dog
dog

<colgroup><col style="width: 25pxpx"><col><col></colgroup><thead>
</thead><tbody>
[TD="align: center"]1[/TD]

[TD="align: center"]2[/TD]

[TD="align: right"]TRUE[/TD]

[TD="align: center"]3[/TD]

[TD="align: right"]TRUE[/TD]

[TD="align: center"]4[/TD]

[TD="align: right"]FALSE[/TD]

[TD="align: center"]5[/TD]

[TD="align: right"]FALSE[/TD]

[TD="align: center"]6[/TD]

[TD="align: right"]TRUE[/TD]

[TD="align: center"]7[/TD]

[TD="align: right"]TRUE[/TD]

[TD="align: center"]8[/TD]

[TD="align: right"]TRUE[/TD]

[TD="align: center"]9[/TD]

[TD="align: right"]FALSE[/TD]

[TD="align: center"]10[/TD]

[TD="align: right"]FALSE[/TD]

[TD="align: center"]11[/TD]

[TD="align: right"]FALSE[/TD]

[TD="align: center"]12[/TD]

[TD="align: right"]TRUE[/TD]

[TD="align: center"]13[/TD]

[TD="align: right"]TRUE[/TD]

[TD="align: center"]14[/TD]

[TD="align: right"]TRUE[/TD]

[TD="align: center"]15[/TD]

[TD="align: right"]TRUE[/TD]

</tbody>
Sheet1

[TABLE="width: 85%"]
<tbody>[TR]
[TD]Worksheet Formulas[TABLE="width: 100%"]
<thead>[TR="bgcolor: #DAE7F5"]
[TH="width: 10px"]Cell[/TH]
[TH="align: left"]Formula[/TH]
[/TR]
</thead><tbody>[TR]
[TH="width: 10px, bgcolor: #DAE7F5"]B2[/TH]
[TD="align: left"]=COUNTIF(A1:A3,A2)>1[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]



You can also use this rule in conditional formatting.

Excellent, and thank you
 
Upvote 0
Is there a way to count only when the data repeats a certain number of times in a row? For example, I need a formula to highlight cells only if the duplicate value occurs 30 or more times consecutively.
 
Last edited:
Upvote 0
Is there a way to count only when the data repeats a certain number of times in a row? For example, I need a formula to highlight cells only if the duplicate value occurs 30 or more times consecutively.

Hi,

Using Jon's sample in post #2, just modify formula like:

Code:
=COUNTIF(A1:A31,A2)>29
 
Upvote 0
Hi,
Thank you for your responses. This is closer to what I need, but =COUNTIF(A2:A31,A2)>=30 does not highlight the final 29 cells in the string of duplicates.
Any ideas how to fix this?

Thanks again!
 
Upvote 0

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top