+ Reply to Thread
Results 1 to 7 of 7

Combining rows with similar data, not exact. Help!

  1. #1
    Registered User
    Join Date
    05-24-2012
    Location
    West Virginia, USA
    MS-Off Ver
    Excel 2007
    Posts
    8

    Question Combining rows with similar data, not exact. Help!

    Okay, I've been searching all over for a solution to this and I have come up with nothing that I can get to line up with what I need to do.

    Problem:

    I have an excel sheet that has around 80,000 employee records in it. The fields in the columns are Employee Number, Person, Assignment, Full Name, Start Date, Position(unique to person), Job (general), Location, Organization, Assignment Start Date, and Assignment End Date.

    The bad thing: This data was pulled from some sort of database that we have here. Many of the records are duplicated on every field except for the Assignment Start and End Date. For Example:

    11, 102, John Doe, Teacher.1256, Teacher, MN, School X, 7/16/2008, 11/15/2010
    11, 102, John Doe, Teacher.1256, Teacher, MN, School X, 11/16/2010, 6/30/2011

    The record being repeated is more than likely due to another field in the database that was not recorded such as a supervisor change. There can also be an unlimited number of occurrences. Also, sometimes one of the fields may have changed and so we would like to keep the records separate, for example:

    11, 102, John Doe, TeacherAssistant.1256, TA, MN, School X, 7/16/2008, 11/15/2010
    11, 102, John Doe, Teacher.1256, Teacher, MN, School X, 11/16/2010, 6/30/2011
    11, 102, John Doe, TeacherAssistant.1256, TA, MN, School X, 7/1/2011, 6/30/2012

    I'm not sure what this is going to take, but any help is appreciated. I'd imagine it would take some sort of loop to go through the entire table to lookup values over and over, but since I don't know VBA I'm out of luck there.

  2. #2
    Forum Contributor wallyeye's Avatar
    Join Date
    05-06-2011
    Location
    Arizona
    MS-Off Ver
    Office 2010, 2007
    Posts
    308

    Re: Combining rows with similar data, not exact. Help!

    What do you want to accomplish here? Do you want to pull the latest record of each occurrence? Do you want all unique entries?

  3. #3
    Registered User
    Join Date
    05-24-2012
    Location
    West Virginia, USA
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Combining rows with similar data, not exact. Help!

    Wallyeye,

    I want to combine the duplicate records as indicated in the example. All of the information in the cells match except for the Assignment End Date and Assignment Start date. Where this is the case, I would like to change the start date to the earliest of the two, and the end date to the later in the two entries.

    Example.xlsx

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

    Re: Combining rows with similar data, not exact. Help!

    try this
    Please Login or Register  to view this content.
    Attached Files Attached Files

  5. #5
    Forum Contributor wallyeye's Avatar
    Join Date
    05-06-2011
    Location
    Arizona
    MS-Off Ver
    Office 2010, 2007
    Posts
    308

    Re: Combining rows with similar data, not exact. Help!

    OK, one more question. In your original post, second sample, you had an employee with a different assignment (2) in between two records (1 and 3) with the same assignment. If you combine 1 and 3 into one record, it will look like the employee was in the 1st/3ird assignment for a period of time that he actually had a different assignment (2nd):

    11, 102, John Doe, TeacherAssistant.1256, TA, MN, School X, 7/16/2008, 11/15/2010
    11, 102, John Doe, Teacher.1256, Teacher, MN, School X, 11/16/2010, 6/30/2011
    11, 102, John Doe, TeacherAssistant.1256, TA, MN, School X, 7/1/2011, 6/30/2012

    to

    11, 102, John Doe, TeacherAssistant.1256, TA, MN, School X, 7/16/2008, 6/30/2012
    11, 102, John Doe, Teacher.1256, Teacher, MN, School X, 11/16/2010, 6/30/2011

    Do you want this representation, or would you rather have them sequential (in this case all three records dsiplayed)? Your sample worksheet is a bit cleaner, it has the same person in the same assignment for two consecutive periods of time, it would make more sense to combine these.

  6. #6
    Registered User
    Join Date
    05-24-2012
    Location
    West Virginia, USA
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Combining rows with similar data, not exact. Help!

    Quote Originally Posted by wallyeye View Post
    OK, one more question. In your original post, second sample, you had an employee with a different assignment (2) in between two records (1 and 3) with the same assignment. If you combine 1 and 3 into one record, it will look like the employee was in the 1st/3ird assignment for a period of time that he actually had a different assignment (2nd):

    11, 102, John Doe, TeacherAssistant.1256, TA, MN, School X, 7/16/2008, 11/15/2010
    11, 102, John Doe, Teacher.1256, Teacher, MN, School X, 11/16/2010, 6/30/2011
    11, 102, John Doe, TeacherAssistant.1256, TA, MN, School X, 7/1/2011, 6/30/2012

    to

    11, 102, John Doe, TeacherAssistant.1256, TA, MN, School X, 7/16/2008, 6/30/2012
    11, 102, John Doe, Teacher.1256, Teacher, MN, School X, 11/16/2010, 6/30/2011

    Do you want this representation, or would you rather have them sequential (in this case all three records dsiplayed)? Your sample worksheet is a bit cleaner, it has the same person in the same assignment for two consecutive periods of time, it would make more sense to combine these.

    Yes, I only want to combine them if the start and end date are one day apart, as such in my example. But, a person may be fired and rehired at the same position like in my first example so I don't want to combine them solely based on the job.

  7. #7
    Forum Contributor wallyeye's Avatar
    Join Date
    05-06-2011
    Location
    Arizona
    MS-Off Ver
    Office 2010, 2007
    Posts
    308

    Re: Combining rows with similar data, not exact. Help!

    See if this does what you want. It will take some tweaking still, but most of it is there.

    Book3.zip

    There are two worksheets, Mult1 and Mult2. Mult1 is the source data, Mult2 is the result. To run the code, go to the VBA IDE (alt-F11), select module1, put your cursor somewhere in the CompareMultiple code and press F5.

+ 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