6 numbers by row

montecarlo2012

Well-known Member
Joined
Jan 26, 2011
Messages
986
Office Version
  1. 2010
Platform
  1. Windows
Hi.
I will try to be Very Clear in the way to explain this.

I am comparing sets of 6 numbers what I want is to be sure that I don’t have any Set
of numbers equal or duplicates
Example
If I have in the sheet 2 in a row, the number 6-21-22-30-45-51 I don’t want this
ROW, to be duplicate, reason why I remark about Row by Row.
I am not thinking even for a second about columns.

ALL ARRAY ARE DYNAMICS.
Sheet 2 array . SIZE at this moment is [L2:Q46] this is the array need to be unique.

Compare SHEET 2 ►AGAINST◄ SHEET 3 to find duplicates
SHEET 3 SIZE at this moment is (R1:W2577)

START
SHEET2 row(L2:Q2) against [sheet3 (R1:W1)]
IF row L2:Q2 = R1:W1 then
Highlight –Sheet2 ROW L2:Q2
DO the same Row by Row until find the last Row on both arrays
END

Is finding and specific Sequence of numbers.
Thank you for reading this post.
(P L E A S E this is NOT a repeated idea OR post, comparing with one of my latest post, maybe close, but NOT equal).
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
I probably wont answer this but...

Are you looking at combinations, ie
to you
is 6-21-22-30-45-51 the a duplicate of 51-45-30-22-21-6 ???

if so then you'll need to sort your two tables and the row you're searching for.
 
Upvote 0
Thank you Special-K99 for reading this post, the answer is Yes Sir, is about whatever is in that ROW and the same with each Row in the Array can be Repeated, and also you are right I am working with combination of numbers is taken six numbers out of 53 any Help will be appreciated.
 
Upvote 0
Is this lottery related?
You might find some online lottery excel spreadsheets that may help
 
Upvote 0
I am is this moment with the Kenneth H. Rosen Book Discrete Mathematics and its Applications Third Edition, chapter 4 Counting, page 296 Generating Combinations; and also with the Book Neil A. Weiss Eelementary Statistics fourth edition part II Descriptive Statistics page 106 Population and Sample Distributions and when Mr. Rosen or Mr. Weiss talked about combinations (including lottery as an example looks like completely find subject to talk about it, in any professional computing programming environment) reason why I am posting this question SIR.
My apology if this type of request it is not allow here.
I just want to confirm IF some patterns with the samples are really countable a new proof. I am a new student on VBA, I understand the Math but when is time for coding then I have problems
Thank you Sir.
 
Last edited:
Upvote 0
You appear to be Checking for duplicates rows by comparing array in sheet1 against array in Sheet2.
Do you also require to check for duplicates, just within Sheet1 array.
 
Upvote 0
Thank you MickG for reading this post. The Dynamic Array on ►SHEET " 2 "◄ is the object that I want to be compare against ►SHEET "3"◄.
Short example:
SHEET2LMNOPQ
262122304551
371621223651
471621223653

SHEET3RSTUVW
1127334453
21915355062
31514181823
 
Last edited by a moderator:
Upvote 0
Try this:-
Non uniques will turn yellow in sheet2.


VBA Code:
Sub MG31Oct26
Dim n As Long, Dic As Object, nStr As String, Txt As String
Dim Ray As Variant, Ac As Long
Set Dic = CreateObject("scripting.dictionary")
Ray = Sheets("Sheet3").Range("R1:W2577")

For n = 1 To UBound(Ray, 1)
    With CreateObject("System.Collections.ArrayList")
        For Ac = 1 To UBound(Ray, 2)
            .Add Ray(n, Ac)
        Next Ac
       
        .Sort
        nStr = Join(.toarray, ",")
       
        If Not Dic.exists(nStr) Then
            Dic.Add nStr, ""
        End If
    End With
Next

Ray = Sheets("Sheet2").Range("L2:Q46")

For n = 1 To UBound(Ray, 1)
 With CreateObject("System.Collections.ArrayList")
        For Ac = 1 To UBound(Ray, 2)
            .Add Ray(n, Ac)
        Next Ac
        .Sort
        Txt = Join(.toarray, ",")
       
        If Dic.exists(Txt) Then
            Cells(n + 1, "L").Resize(, 6).Interior.Color = vbYellow
        End If
End With
Next n
End Sub

Regards Mick
 
Last edited by a moderator:
Upvote 0
Solution

Thank you MickG. I liked I loved.
Just a little adjustment on line 27, I just type Sheet2. so the highlight applyed to that sheet, the other little thing is the color show up after the array for a little segment, that one I couldn't figure out. But like always your work Sir, Your are GREAT, You really know about scripting.dictionary, wow is amazing. awesome.
 
Upvote 0

Forum statistics

Threads
1,224,845
Messages
6,181,298
Members
453,030
Latest member
PG626

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