Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how to compare unsorted array with repeated values in it ?
#1
Not Solved
Code:
Function CompareArrays(arrArray1, arrArray2)

Dim intA1
Dim intA2
Dim blnMatched

' check that the arrays are the same size
If UBound(arrArray1) <> UBound(arrArray2) then

    ' arrays are different size, so return false and exit function
    CompareArrays = False
    Exit Function

End if

' for each element in the first array
For intA1 = LBound(arrArray1) to UBound(arrArray1)

    ' initialise this to false
    blnMatched = False

    ' for each element in the second array
    For intA2 = LBound(arrArray2) to UBound(arrArray2)

        ' compare the content of the two arrays
        If arrArray1 (intA1) = arrArray2 (intA2) Then
            blnMatched = True
            Exit For
        End If

    Next ' next element in second array

    ' if the element was not found in array two, return false and exit function
    If Not blnMatched then
        CompareArrays = False
        print"fail"
        Exit Function
    End If

Next ' next element in first array

' if the function got this far, then the arrays contain the same data
    If CompareArrays = True then

             print "PASS"
    else
        
            Print "FAIL"
     End if

End Function ' CompareArrays

I am using the above function for it but not working properly.
Suggestions
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Compare WebTable Elements saraiado 1 2,449 06-11-2015, 06:54 PM
Last Post: venkatesh9032
  How to compare two binary values Naresh 0 2,171 09-09-2014, 05:06 PM
Last Post: Naresh
  how to remove null values in array venkatesh9032 0 2,752 02-19-2014, 06:51 PM
Last Post: venkatesh9032
  How to convert a single dimension array to two dimensional array venkatesh9032 3 5,195 02-10-2014, 03:07 PM
Last Post: pranikgarg
  how to remove values from an Array. ACCBAJPA 5 4,756 08-23-2013, 12:18 PM
Last Post: ssvali

Forum Jump:


Users browsing this thread: 1 Guest(s)