+ Reply to Thread
Results 1 to 5 of 5

Compare rows in multiple sheets

  1. #1
    Registered User
    Join Date
    03-15-2016
    Location
    Amsterdam, Netherlands
    MS-Off Ver
    2016
    Posts
    23

    Compare rows in multiple sheets

    Hi there,

    I would like to compare rows (with multiple criteria/columns) between two different sheets and if a match is found the row is copied to a new sheet. So for example Sheet1 contains a 10 rows with information in column A to D and Sheet2 also contains 10 rows with information A to D. I would like to copy the rows which contain the same information in column A to D and extract it in a new Sheet3. I've attached a small example file. Hope somebody can help me out with this! Thank you.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Compare rows in multiple sheets

    Maybe:

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    03-15-2016
    Location
    Amsterdam, Netherlands
    MS-Off Ver
    2016
    Posts
    23

    Re: Compare rows in multiple sheets

    Works perfect! Thank you! However, I have one more question. Is it also possible to compare two sheets on values in column A and D and when there is a match found the entire row (including values from column B and C) is copied/extracted in the new Sheet3?

  4. #4
    Forum Contributor
    Join Date
    08-14-2012
    Location
    USA
    MS-Off Ver
    Excel 2007, MS 365 (Windows 10 Pro 64-bit)
    Posts
    810

    Re: Compare rows in multiple sheets

    Modified from Davis' CODE

    Sub Compare_2Rows_AD()
    Dim i As Long, y As Range
    With Sheets("Sheet1")
    For i = 2 To .Range("A" & Rows.Count).End(3).Row
    For Each y In Sheets("Sheet2").Range("A2:A" & Sheets("Sheet2").Range("A" & Rows.Count).End(3).Row)
    If y.Value = .Cells(i, "A").Value And y.Offset(, 3).Value = .Cells(i, "D").Value Then
    .Rows(i).Copy Sheets("Sheet3").Range("A" & Rows.Count).End(3)(2)
    Exit For
    End If
    Next y
    Next i
    End With
    End Sub
    Last edited by tuongtu3; 07-04-2016 at 03:23 AM.

  5. #5
    Registered User
    Join Date
    03-15-2016
    Location
    Amsterdam, Netherlands
    MS-Off Ver
    2016
    Posts
    23

    Re: Compare rows in multiple sheets

    Thank you for the modifying tuongtu3. I was trying to modify it to my specific needs but I couldn't find the right way.. I hope you (or someone ells) could modify it for me?

    In my file I have column A to P containing information (with over 2000 rows). I want to compare column D, F, G, H, I, J, K, L, M, N, O, P in sheet1 with corresponding columns in sheet2. When there is a match found in all of these columns I would like the entire column (including the information in column A, B, C and E) to be copied to sheet3.

    Hope somebody could help me out since I couldn't find the right way to modify the macro that is posted above. Thank you.

+ 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. Replies: 1
    Last Post: 07-23-2015, 10:15 PM
  2. Replies: 7
    Last Post: 05-05-2015, 09:13 AM
  3. How to compare two sheets and get the common rows
    By armstrong123 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 09-26-2014, 11:58 AM
  4. Compare multiple data points in row _ multiple sheets _ output different information
    By floydian in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-18-2013, 08:52 AM
  5. how to compare rows of two sheets with spesific condition
    By sharad pandey in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-22-2011, 03:43 AM
  6. 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

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