Closed Thread
Results 1 to 2 of 2

Compare/Match two columns

  1. #1
    Registered User
    Join Date
    11-07-2010
    Location
    Bangalore, INDIA
    MS-Off Ver
    Excel 2011
    Posts
    6

    Compare/Match two columns

    It will be a great help if someone could guide me to do the following:

    1. compare the Server Name and Serial Number values in Sheet 1 to the same in Sheet 2 and viceversa.
    2. If values match populate the Machine Class column of the Sheet 1 with the Machine Class value from the Sheet 2 of the values found to be matching.


    I have tried vlookup and a macro which actually helped me a bit to find the still no luck :'(

    =VLOOKUP(A2,$B$2:$B$121,1,FALSE)

    and

    =VLOOKUP(B2,$A$2:$A$92,1,FALSE)

    Where I had the Server names from Sheet 1 and Sheet 2 in columns A and B. However, this also didnt solve my problem.

    I have Used this macro tryin to match:

    Sub Find_Matches()

    Dim RangeA As Variant, RangeB As Variant, x As Variant, y As Variant


    Set RangeB = Range("H1:H92")
    Set RangeA = Range("J1:J122")

    For Each x In RangeA
    For Each y In RangeB
    If x = y Then y.Offset(0, 1) = x
    If y = x Then y.Offset(0, 1) = y
    Next y
    Next x

    End Sub

    However, wasn't successful :'(

    Please do help...
    Attached Files Attached Files

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Compare/Match two columns

    heartstealer:

    a) do not post duplicate threads

    b) use Code tags around VBA at all times


    Please ensure you read the Forum Rules before posting further

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1