highlight Consecutive 5 duplicate

sohaila

New Member
Joined
Oct 25, 2015
Messages
39
Office Version
  1. 365
Platform
  1. Windows
Hello

kindly help the formula
I want highlight consecutive 5 duplicated value like

a
b
b
c
c these five value hight
c
c
c
a
a
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
Select the range A1;A20.
Formula for CF.
Excel Formula:
=SUM(1*(IFERROR(COUNTIF(OFFSET(A1,-ROW($1:$5)+1,0,5),A1),0)=5))
I don't think that is very robust. Here I have the post 2 conditional formatting in column A and an alternative in column B. Both show correct results.

24 12 05.xlsm
AB
1aa
2bb
3bb
4cc
5cc
6cc
7cc
8cc
9aa
10aa
11
CF2
Cells with Conditional Formatting
CellConditionCell FormatStop If True
B1:B10Expression=OR(IFERROR(COUNTIF(OFFSET(B1,SEQUENCE(5,,0,-1),0,5),B1),0)=5)textNO
A1:A10Expression=SUM(1*(IFERROR(COUNTIF(OFFSET(A1,-ROW($1:$5)+1,0,5),A1),0)=5))textNO


Now if the user subsequently inserts any rows at the top (eg to add headings) the post 2 CF now returns incorrect results (because the row references change with the insertion) whereas the alternative in column B still highlights the correct rows.

24 12 05.xlsm
AB
1Data 1Data 2
2aa
3bb
4bb
5cc
6cc
7cc
8cc
9cc
10aa
11aa
12
CF2
Cells with Conditional Formatting
CellConditionCell FormatStop If True
B2:B11Expression=OR(IFERROR(COUNTIF(OFFSET(B2,SEQUENCE(5,,0,-1),0,5),B2),0)=5)textNO
A2:A11Expression=SUM(1*(IFERROR(COUNTIF(OFFSET(A2,-ROW($2:$6)+1,0,5),A2),0)=5))textNO
 
Upvote 0
You're welcome. Thanks for the follow-up.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,178
Members
453,021
Latest member
Justyna P

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