Area 2: Sheets (" 2 "). The Range (" A1: F240 "), six in each row number (vary), 240 lines
Area 1 and area 2 to the corresponding line, for example, the area 1 1 line number 1, 2... Sixth, respectively, compared with area 2 line 1 all data, a total of 6 * 6=36 times, if there are at least four is equal to that of the Sheets (" 1 "). The Range (" G1 ") returns 1, otherwise 0,
Then use area 1 line 2 and line 2 of 2, the return value in G2,
Continue to perform other rows,
Test when I'm with randbetween (1100) to generate a random number in the two forms, and then to paste into digital random formulas,
Below is written before net friend help, useful, when asked in area 1 any one of a number is equal to the area 2, return to 1, and now the requirement is at least 4 digits in area 1 and area 2 of four of the six equal to return 1:
Sub t1 ()
Dim a1, a2, I %, j %, s $
A1=Sheets (" 1 "). The Range (" a1: F240 ")
A2=Sheets (" 2 "). The Range (" A1: F240 ")
For I=1 To UBound (a1)
S=", "& amp; The Join (Application. The Index (a1, I), ", ") & amp; ", "
For j=1 To UBound (a1, 2)
If InStr (1 s, ", "& amp; A2 (I, j) & amp; ", ") & gt; 0 Then
Sheets (" 1 "). The Range (" G "& amp; I)=1
The Exit For
End the If
Next
If j=6 Then Sheets (" 1 "). The Range (" G "& amp; I)=0
Next
End Sub
CodePudding user response:
Can be changed slightly:Sub t1 ()
Dim a1, a2, I %, % j, s $, k&
A1=Sheets (" 1 "). The Range (" a1: F240 ")
A2=Sheets (" 2 "). The Range (" A1: F240 ")
For I=1 To UBound (a1)
S=", "& amp; The Join (Application. The Index (a1, I), ", ") & amp; ", "
K=0
For j=1 To UBound (a1, 2)
If InStr (1 s, ", "& amp; A2 (I, j) & amp; ", ") & gt; 0 Then k=k + 1
Next
Sheets (" 1 "). The Range (" G "& amp; I)=k
Next
End Sub