montecarlo2012
Well-known Member
- Joined
- Jan 26, 2011
- Messages
- 986
- Office Version
- 2010
- Platform
- Windows
Hi
Trying to compare two arrays, "range by range".
I will explained the obvious to avoid wrong interpretation
If I have the following sequences in an array
(this is a small example only)
1 2 3
1 3 2
2 3 1
2 1 3
3 2 1
3 1 2
And I want to compare “range” by “range” against the second array
2 3 1
4 5 6
3 1 2
The duplicates here will be only two 231 and 312
Well, my real data location is (“B2:F5000”) array1
To compare against (“I2:M100”)
On column I would like to see “match” or “no”
Thank you for your time, reading this.
Is just a little ilustration, thanks.
VBA Code:
Sub compare_two_array()
Dim B As Variant
Dim A As Variant
B = Range("B2:F13").Value
A = Range("I2:M13").Value
counter = 1
While counter <= UBound(B)
X = B(counter, 1)
Y = A(counter, 1)
If X = Y Then
Range("o2:o13").Value = "match"
Else: Range("o2:o13").Value = "no"
End If
counter = counter + 1
Wend
End Sub
Trying to compare two arrays, "range by range".
I will explained the obvious to avoid wrong interpretation
If I have the following sequences in an array
(this is a small example only)
1 2 3
1 3 2
2 3 1
2 1 3
3 2 1
3 1 2
And I want to compare “range” by “range” against the second array
2 3 1
4 5 6
3 1 2
The duplicates here will be only two 231 and 312
Well, my real data location is (“B2:F5000”) array1
To compare against (“I2:M100”)
On column I would like to see “match” or “no”
Thank you for your time, reading this.
Is just a little ilustration, thanks.