+ Reply to Thread
Results 1 to 6 of 6

Help Please ! Merge two worksheets, then sort, arrange and look for exceptions !

  1. #1
    Registered User
    Join Date
    09-27-2012
    Location
    Orange County, CA
    MS-Off Ver
    Excel 2010
    Posts
    85

    Question Help Please ! Merge two worksheets, then sort, arrange and look for exceptions !

    Hello,

    I am scratching my head and trying to figure out how can I achieve what I am trying to do. Can you please help me or point me in the right direction? I want to be able to write a script or a macro to be able to merge these worksheets based on the criteria !!

    I have data in two sheets, sample 1 and sample 2. The formats will always remain the same as they are export from a pre-defined program and these sheets are emailed out for every project that we work on.
    What I am trying to achieve is:

    1. I want to be able to merge these two worksheets together.
    2. Look up the ID and Name of the resource in the Details sheet.
    3. Match it to the assignments in the Tasks Sheet, first based on ID and then Name.
    4. If there is a match then put them together in the "RESULT" sheet.
    5. For the Non Matching names in the DETAILS worksheet, put them at last as exceptions.

    I am not sure how to do or or if even this can be done or not. I have attached a sample sheet with the data, if you need more information please let me know.

    Any help is appreciated. Can this be done by writing a macro? or this is something that cannot be achieved? Thanks!


    sample_merge.xlsx
    Last edited by desibabuji; 10-16-2012 at 01:42 AM. Reason: fixed the attachment

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Help Please ! Merge two worksheets, then sort, arrange and look for exceptions !

    In your data, 2 individuals have the same ID. So the ID field does not seem to be a unique identifier. Is the name the only unique identifier?
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  3. #3
    Registered User
    Join Date
    09-27-2012
    Location
    Orange County, CA
    MS-Off Ver
    Excel 2010
    Posts
    85

    Re: Help Please ! Merge two worksheets, then sort, arrange and look for exceptions !

    Yes, Name is the only unique identifier.

  4. #4
    Forum Expert
    Join Date
    11-23-2005
    Location
    Rome
    MS-Off Ver
    Ms Office 2016
    Posts
    1,628

    Re: Help Please ! Merge two worksheets, then sort, arrange and look for exceptions !

    See attached file, I hope it's what you need.
    This is the macro I used:
    Please Login or Register  to view this content.
    Regards,
    Antonio
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    09-27-2012
    Location
    Orange County, CA
    MS-Off Ver
    Excel 2010
    Posts
    85

    Re: Help Please ! Merge two worksheets, then sort, arrange and look for exceptions !

    Hi Antonio,

    Thanks for the macro but can you please also help with a couple more things. I think it is very close but just a little more help please

    1. if you look at the results for ID 1004 the exceptions is getting listed before the actual data. Can we list the matches first and then the exceptions? (eg for 1004 both Frank and Sam should come under exceptions)

    2. Also, looking at the code, i was trying to understand how it works so that I can also try to edit/debug it. Does this segment
    Please Login or Register  to view this content.
    3. Also I missed out a couple of columns in the details tab, so added those, Sorry about it. I hope it's not too big an issue.

    sample_merge_db_v1.xlsm


    Does this mean that it will only work if there are only 7 entries in the Details worksheet? Can it be modified so that it will work for the whole worksheet, as the number of rows in both the worksheets will vary. this was just a sample dataset.

    I am sorry if I was not clear in the original request. The format of the data will not change but the number of rows for the data will certainly vary. it can be anywhere from 7 to 700 rows

    Once again, thanks a lot. I really really do appreciate it.
    Last edited by desibabuji; 10-17-2012 at 02:02 AM. Reason: fixed error

  6. #6
    Forum Expert
    Join Date
    11-23-2005
    Location
    Rome
    MS-Off Ver
    Ms Office 2016
    Posts
    1,628

    Re: Help Please ! Merge two worksheets, then sort, arrange and look for exceptions !

    Hello,
    for the point 1. I don't know how to change code as you asked because I think key '1004,Frank Sinds' is different from the key '1004,Sam Cota' and I think there are two headers not present. Please can you attach a little example of how you want result for 1004 code?

    for the point 2. the three rows of code can be deleted... I inserted them because I thought they were necessary for the sort but it's not so.

    The code read te rows number in both sheets 'tasks' and 'details' and so it should work with all rows that are in sheets.

    Regards,
    Antonio

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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