If you find any post useful then, please do share with others. Thanks!

Popular Posts


Email me

Need help and that also free? I like to learn this way, in case of any question or for a small task, please feel free to email me with details and example data, if required.

Friday, October 10, 2014

Compare 2 lists, Easy Way (Excel2010) & a VB Macro

1)      Compare two lists, Easy Way (Excel 2010)
We have two lists/columns of data. Each column should have unique data, use Data->remove duplicate option to remove duplicates of each column.
Select both the lists/Columns
Go to Home Tab > Condition Formatting > Highlight cell rules> Duplicate values.
This will highlight the duplicates that are in both columns and selecting unique in the Bar’s dropdown will highlight the unique values.

2)      Macro to Find Matches between two columns and copying in third
Our data is in Column A and C, running this Macro will put the matches (which are in both columns A & C) in column B.
Sub Matches()
    Dim CRange As Variant, x As Variant, y As Variant
    Set CRange = Range("C1:C2500")
    For Each x In Selection
        For Each y In CRange
            If x = y Then x.Offset(0, 1) = x
        Next y
    Next x
End Sub

1 comment:

  1. Simple and easy. Really smart and quick way. Thanks for sharing.