Compare of two column

Closed
Report
Posts
1
Registration date
Sunday June 25, 2017
Status
Member
Last seen
June 25, 2017
-
Posts
2829
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
November 22, 2021
-
I have 2 columns column a have unique record in repetition and in column b I have non unique values ...now what I want ...I want to place the remarks in column c as mix or non mix
example
A. B. C
Ram 1
Ram 2
Ram 1
Suresh. 1
Suresh. 1

1 reply

Posts
2829
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
November 22, 2021
490
Hi dev_raghav1982,

Give the following code a try and do comment on the result:
Sub RunMe()
Dim mValue As String
Dim x, y, mVar As Integer
Dim Mix As Boolean

x = 2

Do
    mValue = Range("A" & x).Value
    mVar = Range("B" & x).Value
    y = x
    
    Do While Range("A" & x) = mValue
        If mVar <> Range("B" & x).Value Then
            Mix = True
        End If
        x = x + 1
    Loop

    If Mix = True Then
        Range(Cells(y, "C"), Cells(x - 1, "C")).Value = "Mix"
    Else
        Range(Cells(y, "C"), Cells(x - 1, "C")).Value = "Non Mix"
    End If
    
    Mix = False
    
Loop Until Range("A" & x) = vbNullString
End Sub


Best regards,
Trowa