+ Reply to Thread
Results 1 to 5 of 5

How to compare two sheets and get the common rows

  1. #1
    Registered User
    Join Date
    09-24-2014
    Location
    Londoa
    MS-Off Ver
    2010
    Posts
    5

    How to compare two sheets and get the common rows

    Hi,

    I have a excel file which has two sheets and below is the first sheet and second sheet. I want to compare the two sheets (ex: each row of first sheet with with all the rows of second sheet ) and then get all the common/matching rows.( all the column values should be same in both rows). Please help me in figuring this out

    Col-1 Col-2 Col-3
    one data11 data12
    two data21 date22
    three data31 data32
    five date45 data69



    Col-1 Col-2 Col-3
    one data11 data12
    two data21 date22
    three data31 data36
    five date45 data69

    So the end result should be matching rows i.e as below

    Col-1 Col-2 Col-3
    one data11 data12
    two data21 date22

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2502
    Posts
    26,779

    Re: How to compare two sheets and get the common rows

    Shouldn't the matches include

    five date45 data69

    ?

    It is a simple matter to highlight or otherwise flag the rows that match. But if you need to produce a third sheet that lists the matching rows, I think it's going to require a macro. If you attach a file I can take a further look.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Registered User
    Join Date
    09-24-2014
    Location
    Londoa
    MS-Off Ver
    2010
    Posts
    5

    Re: How to compare two sheets and get the common rows

    Hi,

    Thanks for reply. Please see my attachment in excel
    Attached Files Attached Files

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2502
    Posts
    26,779

    Re: How to compare two sheets and get the common rows

    This macro assumes that the first column in both sheets does not have any blanks.

    There are no assumptions about how the sheets are sorted. It walks through each row of First looking for a match in Second.

    I have added a sheet called Common. Go to that sheet and click the button to run the macro.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    09-24-2014
    Location
    Londoa
    MS-Off Ver
    2010
    Posts
    5

    Re: How to compare two sheets and get the common rows

    Thanks a lot. It worked like a charm..

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. compare two excel sheets and extract common data
    By ravindraynk in forum Excel General
    Replies: 3
    Last Post: 07-25-2014, 10:18 AM
  2. Compare two data sheets for common entries
    By anikamenon in forum Excel General
    Replies: 3
    Last Post: 11-17-2012, 12:16 PM
  3. Replies: 3
    Last Post: 10-12-2012, 12:02 AM
  4. macro to compare columns and highlight common rows
    By jagman1990 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-22-2010, 12:27 PM
  5. [SOLVED] compare 2 sheets and extract only new rows
    By John in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-14-2006, 06:10 PM

Tags for this Thread

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