+ Reply to Thread
Results 1 to 10 of 10

Compare sheet and find difference

  1. #1
    Registered User
    Join Date
    10-29-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003
    Posts
    14

    Compare sheet and find difference

    Hello -

    I would like to find a way/macro to find out difference between two sheets matching certain criteria.
    For example:

    Format of sheet 1 is

    ID Department Amount
    123 Finance 100
    123 Education 200
    123 Technology 30
    123 HR 20.5
    6165 Education 20.5
    6165 Technology 45.6
    6165 HR 30
    6165 Hardware 120

    Format (& data)of sheet 2 is
    ID Department Amount
    123 HR 10
    123 Payroll 50
    123 Technology 30
    456 HR 20
    456 Technology 30
    6165 Education 20.5


    I would like a result like this

    ID Name Department Amount(Orig) Amount(New) Comment
    123 John HR 20.5 10 Different
    123 John Payroll Blank 50 Different
    123 John Technology 30 30 Match
    123 John Finance 100 Blank Different
    123 John Education 200 Blank Different
    6165 Harry Education 20.5 20.5 Match
    6165 Harry Technology 45.6 Blank Different
    6165 Harry HR 30 Blank Different
    6165 Harry Hardware 120 Blank Different

    I would like to generate above report for IDs found in sheet 1 only. If you look at above example, ID with value exist in sheet 2 but not in sheet 1. This should not be reported in the result.

    I hope I have made requirements clear. Please feel free to ask me if you have any question. I have also attached a sample file for your reference.
    Attached Files Attached Files
    Last edited by vislavti; 10-30-2011 at 04:09 AM.

  2. #2
    Registered User
    Join Date
    10-29-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003
    Posts
    14

    Re: Compare sheet and find difference

    Hello -

    I would like to find a way/macro to find out difference between two sheets matching certain criteria.
    For example:

    Format of sheet 1 is
    Quote Originally Posted by vislavti View Post
    ID Department Amount
    123 Finance 100
    123 Education 200
    123 Technology 30
    123 HR 20.5
    6165 Education 20.5
    6165 Technology 45.6
    6165 HR 30
    6165 Hardware 120
    Format (& data)of sheet 2 is
    Quote Originally Posted by vislavti View Post

    ID Department Amount
    123 HR 10
    123 Payroll 50
    123 Technology 30
    456 HR 20
    456 Technology 30
    6165 Education 20.5
    I would like a result like this
    Quote Originally Posted by vislavti View Post

    ID Name Department Amount(Orig) Amount(New) Comment
    123 John HR 20.5 10 Different
    123 John Payroll Blank 50 Different
    123 John Technology 30 30 Match
    123 John Finance 100 Blank Different
    123 John Education 200 Blank Different
    6165 Harry Education 20.5 20.5 Match
    6165 Harry Technology 45.6 Blank Different
    6165 Harry HR 30 Blank Different
    6165 Harry Hardware 120 Blank Different
    I would like to generate above report for IDs found in sheet 1 only. If you look at above example, ID with value exist in sheet 2 but not in sheet 1. This should not be reported in the result.

    I hope I have made requirements clear. Please feel free to ask me if you have any question.
    Last edited by vislavti; 10-30-2011 at 12:38 AM.

  3. #3
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,469

    Re: Compare sheet and find difference

    Please post a sample workbook indicating what your raw data looks like, what you expect/hope to see and why.

    Regards
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  4. #4
    Registered User
    Join Date
    10-29-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003
    Posts
    14

    Re: Compare sheet and find difference

    I have attached a sample xls sheet in my original post.

  5. #5
    Registered User
    Join Date
    10-29-2011
    Location
    Solar System, Universe
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Compare sheet and find difference

    I don't know if it's against the rules of this forums to say this (I don't think so, according to what I'm seeing here: http://www.excelforum.com/forum-rule...rum-rules.html ), but MS Access would make this a lot more simple. Each worksheet would be one table (with only 1 row for each person for the ID table), and then two outer-join queries to join on ID.

    This is very doable in Excel, but if you have access to Access, it becomes much simpler and requires no macros.

  6. #6
    Registered User
    Join Date
    10-29-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003
    Posts
    14

    Re: Compare sheet and find difference

    Quote Originally Posted by Disquette View Post
    I don't know if it's against the rules of this forums to say this (I don't think so, according to what I'm seeing here: http://www.excelforum.com/forum-rule...rum-rules.html ), but MS Access would make this a lot more simple. Each worksheet would be one table (with only 1 row for each person for the ID table), and then two outer-join queries to join on ID.

    This is very doable in Excel, but if you have access to Access, it becomes much simpler and requires no macros.

    I agree..using a database would make this very easy. Unfortunately, I would like to use excel.

  7. #7
    Registered User
    Join Date
    10-29-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003
    Posts
    14

    Re: Compare sheet and find difference

    I have made some progress by using divide and conquer strategy. Please see attached in case someone is interested. It is not yet fully resolved.
    Attached Files Attached Files

  8. #8
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: Compare sheet and find difference

    Maybe this? See attached file.
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    10-29-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003
    Posts
    14

    Re: Compare sheet and find difference

    Thank you...this is what i was looking for...

  10. #10
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,469

    Re: Compare sheet and find difference

    See attached:
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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