+ Reply to Thread
Results 1 to 13 of 13

Compare 2 worksheets for difference

  1. #1
    Valued Forum Contributor
    Join Date
    01-11-2012
    Location
    Riyadh, K.S.A.
    MS-Off Ver
    Windows 11 with Excel 2013 & 2016
    Posts
    900

    Compare 2 worksheets for difference

    Hello Again,

    I am looking for VBA macros to compare 2 worksheets within same workbook. I am always receiving more than 10,000 to 50,000 member’s data on daily basis.

    Compare worksheet (Quote List) with worksheet (Policy Issuance List) based on ID number in column H. if difference found then copy entire row to worksheet (Discrepancy Records) and highlight cell value which is changed.

    For Example:

    In worksheet (Quote List) look for ID number “2099421261” i.e. row no. 1 in worksheet (Policy Issuance List) i.e. row no. 3 and found difference in age. So, copy the entire row to worksheet (Discrepancy Records) and highlight cell value E2 in worksheet (Discrepancy Records).

    I hope that above details are sufficient to understand my problem.

    Copy of a sample worksheet is attached for your reference.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Compare 2 worksheets for difference

    Please Login or Register  to view this content.

  3. #3
    Valued Forum Contributor
    Join Date
    01-11-2012
    Location
    Riyadh, K.S.A.
    MS-Off Ver
    Windows 11 with Excel 2013 & 2016
    Posts
    900

    Re: Compare 2 worksheets for difference

    Thanks for your response.

    Now the issue is it is not extracting new records which is in worksheet (Policy Issuance List).

    It is highlighting those cell values which is identical means same values in both sheets.

    For example:

    ASEME ATIK records which is having same data but it is extracting as a error record.
    Philip Atik record their is difference in Gender which mM and M

    Kindly see the attachment in my first post to get a idea what will be the output.

  4. #4
    Forum Expert
    Join Date
    10-10-2008
    Location
    Northeast Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    2,387

    Re: Compare 2 worksheets for difference

    Cross posted here:

    http://www.mrexcel.com/forum/excel-q...ml#post4164934

    A message to forum cross posters.

    Please read this:
    http://www.excelguru.ca/node/7
    Have a great day,
    Stan

    Windows 10, Excel 2007, on a PC.

    If you are satisfied with the solution(s) provided, please mark your thread as Solved by clicking EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

  5. #5
    Valued Forum Contributor
    Join Date
    01-11-2012
    Location
    Riyadh, K.S.A.
    MS-Off Ver
    Windows 11 with Excel 2013 & 2016
    Posts
    900

    Re: Compare 2 worksheets for difference

    Thank Stan for your notification.

    I have already post my original link on the other form.

  6. #6
    Valued Forum Contributor
    Join Date
    01-11-2012
    Location
    Riyadh, K.S.A.
    MS-Off Ver
    Windows 11 with Excel 2013 & 2016
    Posts
    900
    can anyone help me out please

  7. #7
    Valued Forum Contributor
    Join Date
    01-11-2012
    Location
    Riyadh, K.S.A.
    MS-Off Ver
    Windows 11 with Excel 2013 & 2016
    Posts
    900

    Re: Compare 2 worksheets for difference

    can anyone help me please

  8. #8
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Compare 2 worksheets for difference

    Is it common for an ID number to have "**"? This acts as a wild card and messes with the code. I can account for this but need to know if the "**" actually shows up in your real data.

  9. #9
    Valued Forum Contributor
    Join Date
    01-11-2012
    Location
    Riyadh, K.S.A.
    MS-Off Ver
    Windows 11 with Excel 2013 & 2016
    Posts
    900

    Re: Compare 2 worksheets for difference

    No? id cards will be numbers only. I have put these for testing only. I have attached a sample file how will be the output.

    Thanks in advance for your help

  10. #10
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Compare 2 worksheets for difference

    Cell H8 of the sheet "Quote List" has "**" as I indicated. If you change that to an actual number, on both the Quote List sheet and the Policy Issuance List sheet, the code provides the report exactly as you requested:

    For example:

    ASEME ATIK records which is having same data but it is extracting as a error record.
    Philip Atik record their is difference in Gender which mM and M
    Since your actual data will not have "**" in it, the original code should be sufficient.

  11. #11
    Valued Forum Contributor
    Join Date
    01-11-2012
    Location
    Riyadh, K.S.A.
    MS-Off Ver
    Windows 11 with Excel 2013 & 2016
    Posts
    900

    Re: Compare 2 worksheets for difference

    Sorry I have just check thoroughly all the possibilities of comparing data and it working but the only issue is mentioned below.

    1. It is not finding newly record which is not exists in the "Quote List" worksheet and present in "Policy Issuance List" worksheet.
    2. It is not finding removed record which is exist in the "Quote List " worksheet and not present in"Policy Issuance List" worksheet.
    3. It is not returning the remarks.

    Note: If their is not difference found it should popup a message saying "No difference found"

    Please net me know if you need any sample attachment. But I think the attachment in first post is sufficient.
    Last edited by hecgroups; 06-03-2015 at 11:46 AM.

  12. #12
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Compare 2 worksheets for difference

    1. There is no parameter to be able to determine if a record is "new". It simply has no differences.
    2. Amended
    3. It is copying remarks. It is just copying remarks on the Policy Issuance Sheet. If your remarks are only on the Quote List sheet there was no way for me to know that since your example workbook did not show any remarks on either sheet. It has been amended to report the Quote List sheet values instead of Policy Issuance Sheet

    Please Login or Register  to view this content.

  13. #13
    Valued Forum Contributor
    Join Date
    01-11-2012
    Location
    Riyadh, K.S.A.
    MS-Off Ver
    Windows 11 with Excel 2013 & 2016
    Posts
    900

    Re: Compare 2 worksheets for difference

    Thanks stnkynts. However I have do this manual for add/remove record.

    Thanks for your help. Topic marked as solved and reputation added.

+ 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. vba macros to compare 2 worksheets and highlight the difference
    By hecgroups in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-13-2015, 11:16 AM
  2. Replies: 2
    Last Post: 04-12-2013, 06:20 PM
  3. Compare Two Worksheets and give the Difference
    By hakuna.matata in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-22-2012, 03:16 PM
  4. Compare two worksheets and highlight the one sheet’s difference from the other one
    By minrufeng in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-24-2006, 06:28 PM
  5. [SOLVED] How do I compare 2 worksheets, 1 old, 1 updated to find difference
    By alienstew in forum Excel General
    Replies: 1
    Last Post: 01-31-2005, 10:06 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