Highlighting Non-Consecutive Duplicates

Innoguide

Board Regular
Joined
Sep 13, 2011
Messages
159
Does anybody have any suggestions on how to create a conditional rule that finds non-consecutive duplicates in a column of data (numbers or text)? For example, the data below have been highlighted (red text) showing the desired result. Note that all occurrences need to be formatted.

AB
AB
AB
ghy
ghy
ABCD
ABC
r
r
ghy
eee
eee

Any help would be greatly appreciated!
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
In conditional formatting use

Adjust range to match your data, this is for data in A1 though A12.
Code:
=COUNTIF($A$1:$A$12,A1)>1
 
Upvote 0
If i'm understanding what you need, assuming a heading in row 1 and data in A2:A13 , maybe..

Select A2:A13

Use this formula in CF
=COUNTIF(A$2:A$13,A2)<>MAX(FREQUENCY(IF(A$2:A$13=A2,ROW(A$2:A$13)),IF(A$2:A$13<>A2,ROW(A$2:A$13))))
pick the format you want (Font --> red)

M
 
Upvote 0
add this a CF rule:


Excel 2010
AB
1ABFALSE
2ABFALSE
3ABFALSE
4ghyTRUE
5ghyTRUE
6ABCDFALSE
7ABCFALSE
8rFALSE
9rFALSE
10ghyTRUE
11eeeFALSE
12eeeFALSE
Sheet2



Excel 2010
B
1FALSE
Sheet2
Cell Formulas
RangeFormula
B1{=COUNTIF($A$1:$A$12,A1)<>(MAX(IF(A1=$A$1:$A$12,ROW($A$1:$A$12)-ROW($A$1)+1))-MATCH(A1,$A$1:$A$12,0)+1)}
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0
If i'm understanding what you need, assuming a heading in row 1 and data in A2:A13 , maybe..

Select A2:A13

Use this formula in CF
=COUNTIF(A$2:A$13,A2)<>MAX(FREQUENCY(IF(A$2:A$13=A2,ROW(A$2:A$13)),IF(A$2:A$13<>A2,ROW(A$2:A$13))))
pick the format you want (Font --> red)

M




ok I guess we posted more or less the same thing, I had not seen your reply I promise :rofl: ;)
 
Last edited:
Upvote 0
If i'm understanding what you need, assuming a heading in row 1 and data in A2:A13 , maybe..

Select A2:A13

Use this formula in CF
=COUNTIF(A$2:A$13,A2)<>MAX(FREQUENCY(IF(A$2:A$13=A2,ROW(A$2:A$13)),IF(A$2:A$13<>A2,ROW(A$2:A$13))))
pick the format you want (Font --> red)

M
Does the trick -
Thanks Marcelo!
 
Last edited:
Upvote 0
Here's another approach. Try this formula in conditional formatting

=MATCH(2,1/(A$2:A$13=A2))-MATCH(A2,A$2:A$13,0)<>COUNTIF(A$2:A$13,A2)-1

If there are any blanks in the range it won't format those
 
Upvote 0

Forum statistics

Threads
1,223,234
Messages
6,170,891
Members
452,366
Latest member
TePunaBloke

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