Most number repetitive/duplicate occurring in SEQUENCE

ibmy

Board Regular
Joined
Mar 4, 2020
Messages
103
Office Version
  1. 2016
Platform
  1. Windows
Hi,

Can someone help me, sorry for bad English since it is not my native language here.

Ok, I want to find what number in column show "most repetitive/duplicate in SEQUENCE". Im dealing about 100 000 data in a single column.

Here what i have tried:

(1)
I tried use the "most frequently occurring number, =MODE(range) ". I found out that it is not necessary for "most frequently occurring number" to be "most in repetitive/duplicate in sequence".

What I mean is, let say, number 7.77 is the "most frequently occurring number" in column A, but it is not appear to be in sequence. The number "most repetitive/duplicate in sequence" can be the "least frequently occurring number" in column.

What I means "sequence" is, in column A, in row 4,5,6,7,8,9 | 101,102,103,104 | 333,334,345,346,etc.. show that 6.66 is the ""most repetitive/duplicate in SEQUENCE".

While the number 7.77 is "most frequently occurring number" but not in "sequence", it show at random row 11,67,102,678,etc...

(2)
I tried use Conditional Formatting to highlight duplicate. The reason I use this is if I can manually (scrolling) detect duplicate which number to be appear repetitive in sequence.

The problem with this method is there are so many duplicate numbers Im dealing with, 100 000 data but the specific I want is , "the most repetitive/duplicate in sequence" not just random row.

...

Any solution is welcomed, either :

i- Highlight only number in repetitive/duplicate in sequence. ( can be tedious since 100 000 data is too much for me to manually checking (Scrolling).

*ii- Formula to show most number in repetitive/duplicate in sequence. ( I prefer this one)

iii- Or any other method.

Thanks for reading my problem & sorry for bad english.
 

Attachments

  • upload.png
    upload.png
    18.1 KB · Views: 34
Last edited by a moderator:

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
Hi, ibmy. Welcome to MrExcel.

Try this:
Data in col A, result in C1:
VBA Code:
Sub a1126361a()
'https://www.mrexcel.com/board/threads/most-number-repetitive-duplicate-occurring-in-sequence.1126361/
Dim i As Long, j As Long
Dim z As Double, x As Double, y As Double
Dim va

va = Range("A1", Cells(Rows.Count, "A").End(xlUp))
For i = 1 To UBound(va, 1)
 j = i
    Do
        i = i + 1
        If i > UBound(va, 1) Then Exit Do
    Loop While va(i, 1) = va(i - 1, 1)
    i = i - 1
    z = i - j + 1
    If z > x Then x = z: y = va(j, 1)

Next

Range("C1") = y
End Sub

Example:
Book1
ABC
16.32.3
22.2
32.2
43.2
51.3
61.3
73.3
83.3
92.3
102.3
112.3
122.3
131.3
143.3
152.3
162.3
171.3
181.3
Sheet2


If you want I can amend the code as UDF (User Defined Function) so you can use it as formula.
 
Upvote 0
Solution
Hi and welcome to MrExcel!

With the following Conditional Formatting the first cell where the largest sequence starts is highlighted.
Start putting your numbers in cell A2 as shown in the following:

Dante Amor
A
1NUMBER
267
367
467
568
667
767
867
967
1065
1165
1265
1365
1465
1565
1665
1767
1867
1965
2067
2167
Sheet1


Formula for conditional formating

=COUNTIF(OFFSET(A1,1,0,MAX(FREQUENCY(IF(($A$3:$A$210<>"")*($A$3:$A$210-$A$2:$A$209=0),ROW($A$3:$A$210)),IF($A$3:$A$210-$A$2:$A$209<>0,ROW($A$3:$A$210))))+1),A2)=MAX(FREQUENCY(IF(($A$3:$A$210<>"")*($A$3:$A$210-$A$2:$A$209=0),ROW($A$3:$A$210)),IF($A$3:$A$210-$A$2:$A$209<>0,ROW($A$3:$A$210))))+1
 
Upvote 0
A Power Query way.

Book1
ABCD
1RawRawCount
26.32.34
32.2
42.2
53.2
61.3
71.3
83.3
93.3
102.3
112.3
122.3
132.3
141.3
153.3
162.3
172.3
181.3
191.3
Sheet1


Code:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    Group = Table.Group(Source, {"Raw"}, {{"Count", each Table.RowCount(_), type number}},GroupKind.Local),
    Filter = Table.SelectRows(Group, each [Count] = List.Max(Group[Count]))
in
    Filter
 
Upvote 0

Forum statistics

Threads
1,214,812
Messages
6,121,693
Members
449,048
Latest member
81jamesacct

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