+ Reply to Thread
Results 1 to 7 of 7

Comparing two lists and extracting differences

  1. #1
    Registered User
    Join Date
    01-14-2019
    Location
    Nepal
    MS-Off Ver
    Office 365
    Posts
    4

    Comparing two lists and extracting differences

    Hi, I have spent a significant amount of time trying to figure out how to do this before coming here, unfortunately given I rely on the macro recorder and other's code examples I am unable to resolve this so many thanks in advance!

    I have two lists which 'should' reconcile. Within each list/row is several variables - buy/sell (direction), amount, rate and currency - these all need to match, among other entries that won't need to be matched.

    The difficult part is that there may be duplicates within each list as not all users can see all entries. For example, say there are 3 of the same entries in only one sheet, but 2 in the other (all identical however). I need to avoid confirming they match if the 3 identical entries match against a single entry in the other list (so needs to be able to treat each entry as unique). I thought of resolving this issue by deleting a matching row every time there is a match, hence in the above example, once it matched the first 2 of the 3 entries, the script will be unable to match the last (3rd) entry given the other 2 were deleted.

    I would then copy the remaining entries (the entire row of that particular list only) from the list that has deleted entries and copy them into an unmatched sheet. I would then reverse the process and do it the other way around to identify discrepancies in the initial list.

    Perhaps someone can suggest a smarter way of doing this over all? Perhaps prescribe each row in each list a unique variable and then match them off, extracting any remaining unmatched variables?

    Thanks

    EDIT: To clarify, the comparable fields are not next to one another, so the code needs to accommodate comparing fields within a row of differing positions.
    Last edited by irbadatvba; 01-14-2019 at 10:29 PM.

  2. #2
    Forum Expert kersplash's Avatar
    Join Date
    11-22-2016
    Location
    Perth
    MS-Off Ver
    Home 2016 (Windows 10)/Work 2013 Pro Plus (Windows 10)
    Posts
    2,012

    Re: Comparing two lists and extracting differences

    You could use Data -> Get & Transform for this sort of thing.

    Can you attach a small sample showing what you are trying to achieve?

    Go Advanced -> Manage Attachments -> Upload

  3. #3
    Registered User
    Join Date
    01-14-2019
    Location
    Nepal
    MS-Off Ver
    Office 365
    Posts
    4

    Re: Comparing two lists and extracting differences

    Hi kersplash, thanks for your reply. This is my attempt so far:

    Please Login or Register  to view this content.
    None of the formulas work at the bottom when I try using the variables in order to loop through the list with iRow = iRow + 1. Once I am able to do this, I believe I will have finished. Instead colNum = Formula(Evaluate) returns an error. Any advice? I have tried searching extensively. Similarly used the Watcher tab to see what the value was while executing.

  4. #4
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Comparing two lists and extracting differences

    Could you post a workbook with a sample of representative data and the desired result?
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  5. #5
    Registered User
    Join Date
    01-14-2019
    Location
    Nepal
    MS-Off Ver
    Office 365
    Posts
    4

    Re: Comparing two lists and extracting differences

    Thanks for your replies, please find attached an example.

    Basically, I have two lists (there are actually many lists that are compared/reconciled daily) that need to be equal. However, as mentioned there are sometimes duplicates or even multiplies entries of the same between lists. In which case I can't double or triple count a positive match based off only one match in the other list.

    This is why I have used the MATCH function (which will ultimately loop through the list) to identify and then delete the first matching entry.

    Ideally, both lists would be compared to one another concurrently and mismatched entries would just be highlighted as opposed to deleted, but I can't figure out a simple way to do this.
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    01-14-2019
    Location
    Nepal
    MS-Off Ver
    Office 365
    Posts
    4

    Re: Comparing two lists and extracting differences

    Bump. Please help.

  7. #7
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 365 version 2501
    Posts
    18,930

    Re: Comparing two lists and extracting differences

    Hello irbadatvba and Welcome to Excel Forum.
    Here is a formula based proposal that employs multiple (formula populated) helper columns.
    The gist is that columns K and S concatenate the information that needs to be matched.
    Column L displays whether or not the information in the first table matches that in the second.
    Column T displays how many times the information in the second table matches the first (if any).
    Column U displays the first row of the match (or FALSE if there isn't one).
    On the Unmatched sheet column A displays the full list of unmatched concatenated items from both tables.
    Column B displays whether or not the items are unique.
    Column D displays the unique list of items.
    Columns E:M display variables for each item based on the column headers for the first table.
    Note that F88, J88 and L:M88 are blank as there is no information pertaining to those variables in the second table.
    Let us know if you have any questions.
    Attached Files Attached Files
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

+ 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. is there a way of extracting differences between two spreadsheets?
    By centraltickets in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 06-29-2017, 11:11 AM
  2. Add or remove info to lists and highlight differences between two lists
    By alipezu in forum Hello..Introduce yourself
    Replies: 1
    Last Post: 03-30-2014, 08:51 PM
  3. Comparing and extracting data from 2 lists
    By blue5ky in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-15-2014, 12:22 AM
  4. [SOLVED] Comparing 2 Lists to Identify Differences
    By ORRACLE1 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 12-10-2012, 02:26 PM
  5. Comparing differences between two columns
    By MI_Analyst in forum Excel General
    Replies: 1
    Last Post: 11-02-2010, 06:51 AM
  6. Comparing two lists and extracting data from one to another
    By Clement in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-12-2006, 02:40 PM
  7. Comparisons & Extracting Differences
    By Pauldls in forum Excel General
    Replies: 1
    Last Post: 03-17-2005, 07:58 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