+ Reply to Thread
Results 1 to 6 of 6

Comparing Two Ranges (advanced)

  1. #1
    Registered User
    Join Date
    06-24-2015
    Location
    United States
    MS-Off Ver
    2010
    Posts
    21

    Comparing Two Ranges (advanced)

    compare list.xlsx

    Hello All!

    So I am struggling with a problem. The issue involves comparing two ranges. I have to sort through a large list for duplicates and differences. The ranges are text based such as GM7, T6S, GE-68..etc. My dream is to take duplicates of data from a open workbook and compare it to a given range in a separate file, and print them out on another worksheet. This may involve running a program?

    Ideally there would be a file that contains a range of data (A). The duplicates of list (B) to be compared to the data (A) that is in a different file. The duplicates of (B) to be printed on another sheet. The non-duplicating data will also be sent to another sheet. (If the contents cannot be sent to a different sheet, another column would be Ok, but not ideal).

    What I have now....
    List A needs to be compared to List B. I have found a way to print the duplicates. This is how I did it...

    =IF(ISERROR(MATCH(A1,$B:$B,0)),"",A1) ------------ This would ultimately print out the duplicate, if there was no duplicate, then nothing is printed in column C.

    What I want....
    List A is in a separate file. I have List B. I run a compare function. The function/program prints out duplicates in another sheet or column (if necessary). The function /program prints out the differences in another sheet or column.

    Thanks, I hope you can understand the question! - I attached my compare file

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Comparing Two Ranges (advanced)

    This should be quite simple.

    In your new workbook, ensure that there are three sheets.

    Your new data is in sheet1.

    use a formula in sheet 2 to compare the new data with your compare list.

    Copy paste values to get rid of your formula

    Sort by the formula column

    find where the matched values end / unmatched values start

    Cut one lot and paste into sheet3.


    Please Login or Register  to view this content.

    The code is more complex then it needs to be, but thats so it can be called from any sheet.

    It runs without moving between sheets.
    Attached Files Attached Files
    Last edited by mehmetcik; 12-14-2015 at 02:20 PM.
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

  3. #3
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Comparing Two Ranges (advanced)

    If I understand correctly, I used two helper columns on sheet1 (C and D)
    First inserted a blank row, then in C2

    =IF(ISTEXT(A2),IF(ISERROR(MATCH(A2,B:B,0)),MAX($C$1:C1)+1,""),"")

    In D2

    =IF(ISTEXT(B2),IF(ISERROR(MATCH(B2,A:A,0)),MAX($D$1:D1)+1,""),"")

    You can hide those two columns if you wish.

    In in a new sheet, "On B Not A" dragged down

    =IFERROR(INDEX(Sheet1!$B$1:$B$579, MATCH(ROWS($A$1:$A1), Sheet1!$D:$D,0)),"")

    On A Not B dragged down

    =IFERROR(INDEX(Sheet1!$A$1:$A$579, MATCH(ROWS($A$1:$A1), Sheet1!$C:$C,0)),"")
    Attached Files Attached Files
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  4. #4
    Registered User
    Join Date
    06-24-2015
    Location
    United States
    MS-Off Ver
    2010
    Posts
    21

    Re: Comparing Two Ranges (advanced)

    Thank you for your input!

  5. #5
    Registered User
    Join Date
    06-24-2015
    Location
    United States
    MS-Off Ver
    2010
    Posts
    21

    Re: Comparing Two Ranges (advanced)

    Now is there a way to have List B as a separate file that I can open up and compare List A to that data base?

  6. #6
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Comparing Two Ranges (advanced)

    Sure, to see how the formulas will look, just select column B and Cut. Then paste it into a new book. All the formula's will update automatically.

+ 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. Excel 2007 : Advanced comparing two columns
    By Moerz77 in forum Excel General
    Replies: 9
    Last Post: 06-03-2011, 06:51 PM
  2. Comparing to ranges
    By Jonathan78 in forum Excel General
    Replies: 4
    Last Post: 09-20-2009, 01:51 AM
  3. Comparing Ranges
    By Paul987 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-19-2008, 08:41 PM
  4. Comparing Ranges
    By elisebev in forum Excel General
    Replies: 1
    Last Post: 04-11-2007, 07:58 AM
  5. Comparing two ranges
    By Utkarsh in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-26-2006, 08:50 AM
  6. Comparing ranges:
    By ben simpson in forum Excel General
    Replies: 1
    Last Post: 03-08-2006, 12:40 AM
  7. Advanced filter: criteria in non-adjacent ranges?
    By count in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-11-2005, 10:05 AM
  8. Advanced filter in VBA - criteria in non-adjacent ranges
    By count in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-11-2005, 09:05 AM

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