+ Reply to Thread
Results 1 to 4 of 4

Compare/Match two columns

Hybrid View

  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
    Last edited by heartstealer; 11-07-2010 at 03:42 PM.

  2. #2
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Compare/Match two columns

    you only have one match from sheet 1 to sheet 2 thats row 4
    cddev 937h2fd9 thats using
    =INDEX(Sheet2!B2:B1000,MATCH(A2&G2,INDEX(Sheet2!A2:A1000&Sheet2!D2:D1000,0),0))
    in sheet1!I2 dragged down
    Attached Files Attached Files
    Last edited by martindwilson; 11-07-2010 at 03:18 PM.
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

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

    Re: Compare/Match two columns

    Hi Martin,

    Thanks for the quick formula which does the trick... However, does it compare the both Server names? Like Will it check if the Sheet 2 Server names are present in Sheet 1 also?

    Thx in Advance

  4. #4
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Compare/Match two columns

    you dont say what you want to return so just to sheck if its present in sheet 1 .
    in sheet 2 E2 put something like this
    =ISNUMBER(MATCH(A2&D2,INDEX(Sheet1!$A$2:$A$1000&Sheet1!$G$2:$G$1000,0),0))
    this will return TRUE when a match is found

+ Reply to 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