• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Highlight duplicate values that appear more than 12 times consecutively

PendekarMakao

New Member
Dear all,

I would like to find a way to highlight duplicate values if it is appear more than 12 times consecutively.

I have attached the file for you to understand what I am trying to do.

Thank you
 

Attachments

  • Consistency Status.xlsx
    10.4 KB · Views: 8
i think this may work
=SUM(IF(FREQUENCY(IF($B1:$P1=1,COLUMN($B1:$P1)),IF($B1:$P1<>1,COLUMN($B1:$P1)))>=12,1))

this is 12 or more
if you want more than 12

=SUM(IF(FREQUENCY(IF($B1:$P1=1,COLUMN($B1:$P1)),IF($B1:$P1<>1,COLUMN($B1:$P1)))>12,1))
 

Attachments

  • Consistency Status -ETAF.xlsx
    12.5 KB · Views: 7
to highlight duplicate values if it is appear more than 12 times consecutively
See conditional formatting in cells B2: P6 of the attached. It highlights repeating 1s when they're part of a run of 13 or more.
If you want to highlight repeating values, whatever those values happen to be, change the CF formula from:
=RepeatCount(B2,$B2:$P2,1)>12
to:
=RepeatCount(B2,$B2:$P2,B2)>12

Sample formulae below row 9.
The named lambda function is easy to copy to your own workbook by copying the sheet to your own workbook and immediately deleting it again; the function should remain.
 

Attachments

  • Chandoo57593Consistency Status.xlsx
    16.8 KB · Views: 5
See conditional formatting in cells B2: P6 of the attached. It highlights repeating 1s when they're part of a run of 13 or more.
If you want to highlight repeating values, whatever those values happen to be, change the CF formula from:
=RepeatCount(B2,$B2:$P2,1)>12
to:
=RepeatCount(B2,$B2:$P2,B2)>12

Sample formulae below row 9.
The named lambda function is easy to copy to your own workbook by copying the sheet to your own workbook and immediately deleting it again; the function should remain.
This is exactly what I am trying to do. But why can't I use =repeatcount formula in my excel file?
 
please explain the lambda function

Aaaaagh!

First, there's very, but very, likely a much more straightforward solution than the one I've produced; it's just the route I ended up taking after experimentation and the first one that seemed to work.

Look at sheet Sheet2 (2) of the attached where I've put the full version of the lambda formula in cell H4, and put it onto several lines to try to make it easier to read.
A lambda function takes on the arguments in brackets after it, in the order they appear in:

1724409576091.png

Within a LET statement, it's the last item that is returned (result in the picture above).
In cells H6:H11 I've used the same formula but changed the last item of the LET statement so that you can see what each item returns.
Here's the one for LSide:

1724410115798.png
(It's showing zeroes for spaces but it doesn't matter. Edit: If you're looking for repeating zeroes it does matter. The formula would need a tweak to correct for this.)

The most difficult items to understand are RMatch and LMatch; I've used XMATCH to search for the first cell which doesn't contain the repeating value you're looking for, searching from the right end for the LSide, and from the left for RSide. The IFERROR bits are to cater for when all the cells contain the repeating value when XMATCH would return #N/A, so the count in that case is the same as the number of columns in LSide/RSide.
result is the SUM of LMatch and RMatch, but since the LSide and RSide overlap by one cell that cell gets counted twice so 1 is subtracted, but if there are no matching values that would result in -1, hence the MAX function.

Note that Acell, FullRng, repeatingValue, SplitColm, LSide, RSide, LMatch, RMatch & result, are all 'variable names' that I've dreamt up and are not built-in Excel functions. You can replace them with your own names.

That's as far as I'm prepared to go.
If I happen to come across a more straightforward formula I'll post again.
 

Attachments

  • Chandoo57593Consistency Status02.xlsx
    20 KB · Views: 1
Last edited:

PendekarMakao

As You've read from Forum Rules:
  • Cross-Posting. Generally, it is considered poor practice to cross post. That is to post the same question on several forums in the hope of getting a response quicker.
  • If you do cross-post, please put that in your post.
  • Also if you have cross-posted and get an Solution elsewhere, have the courtesy of posting the Solution here so other readers can learn from the answer also, as well as stopping people wasting their time on your answered question.
These rules are for everyone.
 
Back
Top