'I want to search similarities in Two-Dimensional array

I have one for normal array, I would like help to see how I can use it to search in a Two-Dimensional one, or see if someone can teach me a better way

I'm been really burnout lately so i would like to know if i post it in the wrong place or if I've done something wrong, please

    Do
        BANDERA = 0
        For i = 0 To 4 - 2
            If A(i) > A(i + 1) Then
                T = A(i)
                A(i) = A(i + 1)
                A(i + 1) = T
                BANDERA = 1
            End If
        Next
    Loop Until BANDERA = 0
    Do
        BANDERA = 0
        For i = 0 To 4 - 2
            If B(i) > B(i + 1) Then
                T = B(i)
                B(i) = B(i + 1)
                B(i + 1) = T
                BANDERA = 1
            End If
        Next
    Loop Until BANDERA = 0
    c = 0
    For i = 0 To 4 - 1
        If B(i) <> B(i + 1) Then
            c = c + 1
            NUM(c) = B(i)
        End If
    Next
    X = 0
    For j = 1 To c
        BANDERA = 0
        For i = 0 To 4 - 1
            If NUM(j) = A(i) Then
                If BANDERA = 0 Then
                    X = X + 1
                    COINCI(X) = A(i)
                    BANDERA = 1
                End If
            End If
        Next
    Next


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source