+ Reply to Thread
Results 1 to 17 of 17

Compare two data sets from two worksheets and output into 3 different sheets

  1. #1
    Registered User
    Join Date
    09-08-2017
    Location
    Houston, Texas
    MS-Off Ver
    2010, 2016
    Posts
    34

    Question Compare two data sets from two worksheets and output into 3 different sheets

    I know this has been asked a bazillion times on comparing two columns / sheets / workbooks but I can't seem to find out how to do this. My scenario is that I want List A to be compared with List B and have the rows copied to their respective sheets based on criteria of: missing, unique, match. I've found a snippet that does just that except it's on one sheet and doesn't copy the entire row. Any help would be greatly appreciated!

    Please Login or Register  to view this content.
    Attached Files Attached Files

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,480

    re: Compare two data sets from two worksheets and output into 3 different sheets

    Check it out.

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    09-08-2017
    Location
    Houston, Texas
    MS-Off Ver
    2010, 2016
    Posts
    34

    re: Compare two data sets from two worksheets and output into 3 different sheets

    Good morning, Dave!

    Thanks for the quick reply and update! The code works perfectly but is there a way to split all the data into 3 arrays and output it just once without the loop?

  4. #4
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,480

    re: Compare two data sets from two worksheets and output into 3 different sheets

    I never worked much with arrays, even with arrays, you are still looping.

  5. #5
    Registered User
    Join Date
    09-08-2017
    Location
    Houston, Texas
    MS-Off Ver
    2010, 2016
    Posts
    34

    re: Compare two data sets from two worksheets and output into 3 different sheets

    Dang. I'll use your code and try to mess around with arrays more. I'm trying to understand them myself ^_^

  6. #6
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,077

    re: Compare two data sets from two worksheets and output into 3 different sheets

    How about
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    09-08-2017
    Location
    Houston, Texas
    MS-Off Ver
    2010, 2016
    Posts
    34

    re: Compare two data sets from two worksheets and output into 3 different sheets

    Hi Fluff!!

    Thanks for the code! It's much closer to what I was looking for! I'm getting a subscript out of range though. The debug line highlights this line of code:

    Please Login or Register  to view this content.
    Is there a solution for that?

  8. #8
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,077

    re: Compare two data sets from two worksheets and output into 3 different sheets

    Are you getting that on your test file, or on real data?
    As it works for me on the test file.

  9. #9
    Registered User
    Join Date
    09-08-2017
    Location
    Houston, Texas
    MS-Off Ver
    2010, 2016
    Posts
    34

    re: Compare two data sets from two worksheets and output into 3 different sheets

    test file still. I've only changed the values of the numbers and added letters. The first time I ran it, no problems with the sample numbers but when I changed the sample data I received an error. Attached will be the same file with your code.

    EDIT: Looks like I can't have any data in column B in Sheet2. Is it possible to include that in the data as well?
    Attached Files Attached Files
    Last edited by huyza_0100; 06-16-2018 at 05:09 PM.

  10. #10
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,077

    re: Compare two data sets from two worksheets and output into 3 different sheets

    Ok how about
    Please Login or Register  to view this content.

  11. #11
    Registered User
    Join Date
    09-08-2017
    Location
    Houston, Texas
    MS-Off Ver
    2010, 2016
    Posts
    34

    Re: Compare two data sets from two worksheets and output into 3 different sheets

    that works! Thanks again Fluff!!! I'll have to study your array setup and see if I can break it down and learn it myself.

  12. #12
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,077

    Re: Compare two data sets from two worksheets and output into 3 different sheets

    Glad to help & thanks for the feedback

  13. #13
    Registered User
    Join Date
    09-08-2017
    Location
    Houston, Texas
    MS-Off Ver
    2010, 2016
    Posts
    34

    Re: Compare two data sets from two worksheets and output into 3 different sheets

    Hey Fluff,

    Sorry. I'm still having issues...

    Please Login or Register  to view this content.
    I'm getting run time error '5' this time...Maybe there's a clash in the calling / naming?

    EDIT: Seems like the issue is with the transpose: expression not defined in context. Anyone know what that means?
    Attached Files Attached Files
    Last edited by huyza_0100; 06-16-2018 at 07:35 PM.

  14. #14
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Compare two data sets from two worksheets and output into 3 different sheets

    Try
    Please Login or Register  to view this content.

  15. #15
    Registered User
    Join Date
    09-08-2017
    Location
    Houston, Texas
    MS-Off Ver
    2010, 2016
    Posts
    34

    Re: Compare two data sets from two worksheets and output into 3 different sheets

    Jindon, that looks hella complicated but it works! No errors! Thanks for the amazing code!!

  16. #16
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Compare two data sets from two worksheets and output into 3 different sheets

    You are welcome and thanks for the rep.

    If you want something like your original then
    Please Login or Register  to view this content.

  17. #17
    Registered User
    Join Date
    09-08-2017
    Location
    Houston, Texas
    MS-Off Ver
    2010, 2016
    Posts
    34

    Re: Compare two data sets from two worksheets and output into 3 different sheets

    the second snippet definitely is easier to read! Thanks again for the help!

+ 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. How To Compare Two Sets Of Similar Data Sets To Find a Good Match
    By Mark123456789 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-24-2016, 01:29 AM
  2. [SOLVED] Compare two columns on different worksheets, output matches and certain row data to third
    By bryan nelson in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-01-2015, 03:21 PM
  3. vba compare two sets of values in two worksheets
    By heartsafire1023 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-15-2014, 01:31 AM
  4. Formula to compare two sets of similar data on two sheets
    By twoheadedgames in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 07-23-2013, 04:18 AM
  5. Compare two sheets of Data and output Variance on New Sheet
    By artikyulashun in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-07-2012, 01:51 AM
  6. How to compare two worksheets and output the results
    By MrDisco1 in forum Excel General
    Replies: 1
    Last Post: 03-25-2009, 05:17 PM
  7. Compare data with in a couple of sheets then output to a blank sheet
    By Sabo, Eric in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-22-2006, 11:10 AM

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