Compare two worksheets

  • Required to compare two workesheets and the result to write in third worlsheet.

    Attached an example that should be compared.
    Explanation: 1. Worksheet "Original DB"
    2. Worksheet "Customer DB"
    3. Worksheet "Compare"
    All comparisons I make by the car type.
    In attached example the "Compare" worksheet shows the required differences.

    Any idea for algorythm of VBA code will kindly appreciated.

  • Re: Compare two worksheets

    I am presenting a very basic solution:

    Set up a comparison table on your 'Report' Worksheet:

    ='Original DB'!A2='Customer DB'!A2
    and so on for each field of the database

    =IF(AND($C2:$F2),"All Correct","For "&'Original DB'!$A2&" wrong '"&INDEX($C$1:$F$1,MATCH(FALSE,$C2:$F2,0))&"'")

    Will find any mismatches and report the first one.

    This will only work if there is a 1:1 correspondence between the Original DB and Customer DB.

    If there are any missed, swapped or duplicate entries or if there is any other mismatch in structure between the two databases then this approach will fail to give you the results you want. However for your sample data it works.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!