I need macro script that will compare values in column a with values in column b,if there are values that are in a but not in b, such values are copied into column c, if there are values in column b that are not in column a, such values are copied to column d and place the duplicates (values in column a that also appear in column b) are copied into column e.
I hope i can get macros that can be used for this.
Thanks
Macros to compare values in two columns and place the duplicates in third column
-
-
-
Re: Macros to compare values in two columns and place the duplicates in third column
Code
Display MoreSub dave() For Each c In Intersect(Sheet1.Columns(1), Sheet1.UsedRange).Cells Set d = Intersect(Sheet1.Columns(2), Sheet1.UsedRange).Find(c.Value, lookat:=xlWhole) If d Is Nothing Then Sheet1.Cells(65000, 3).End(xlUp).Offset(1, 0).Value = c.Value Else Sheet1.Cells(65000, 5).End(xlUp).Offset(1, 0).Value = c.Value End If Next For Each c In Intersect(Sheet1.Columns(2), Sheet1.UsedRange).Cells Set d = Intersect(Sheet1.Columns(1), Sheet1.UsedRange).Find(c.Value, lookat:=xlWhole) If d Is Nothing Then Sheet1.Cells(65000, 4).End(xlUp).Offset(1, 0).Value = c.Value End If Next End Sub
-
Re: Macros to compare values in two columns and place the duplicates in third column
THANKS richadj4.
I ran the code and it worked well.
Please is there any adjustment that can be made to the code to make the search and results to start from row 2 for all the columns.
This is to give allowance for column titles.
Thanks again -
-
Re: Macros to compare values in two columns and place the duplicates in third column
Richardj4, Thanks for your assistance.
Kindly assist with same code but which will cut the duplicates to the third column.
Thank you -
-
Participate now!
Don’t have an account yet? Register yourself now and be a part of our community!