+ Reply to Thread
Results 1 to 10 of 10

Remove duplicates and consolidate data in duplicated fields.

  1. #1
    Registered User
    Join Date
    10-23-2012
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    6

    Cool Remove duplicates and consolidate data in duplicated fields.

    Hi All. Hope today is going well

    I am trying to learn VBA but only starting.

    I have a excel vba task to complete ( A sample file is attached)

    Data in spreadsheet is shown "BEFORE" as in raw file and "AFTER" example of what should look like after macro is run.

    AIM IS TO REMOVE DUPLICATE ROWS OF SAME "MOBILE NUMBER" BUT RETAIN ANY "WEBSITE 2" OR "EMAIL" IN ANY DUPLICATED ROWS BEFORE DELETING THE OTHER DUPLICATE RECORDS.

    1. "MOBILE" IS SORTED IN ASCENDING ORDER
    2. IF NO DUPLICATE GO ONTO NEXT ROW
    3. GO DOWN LIST CHECK FOR DUPLICATES (CAN BE MORE THAN ONE DUPLICATE I.E KLAUDIA IN "BEFORE")
    4. WHEN FIND DUPLICATE "IF EMAIL" IS BLANK - CHECK IF THERE IS AN EMAIL IN ANY DUPLICATE FIELD AND BRING THAT TO THE FIRST DUPLICATE
    5. WHEN FIND DUPLICATE "IF WEBSITE 2" IS BLANK CHECK IF THERE IS A "WEBSITE 2" IN ANY DUPLICATE FIELD AND BRING THAT TO THE FIRST DUPLICATE
    6. KEEP FIRST DUPLICATE WITH EMAIL AND WEBSITE 2 POPULATED (IF DATA) AND DELETE DUPLICATES BELOW
    7. MOVE ONTO NEXT MOBILE NUMBER CHECKING IF A DUPLICATE ETC


    COULD BE 5000 ROWS+


    Appreciate your expertise and time in advance
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor
    Join Date
    11-15-2008
    Location
    ph
    MS-Off Ver
    2007/2010/2016
    Posts
    479

    Re: Remove duplicates and consolidate data in duplicated fields.

    Hi -

    Run this code in the sample data provided.

    The output goes to column G (No deletion is being made here rather a unique data will be pulled out).

    Please Login or Register  to view this content.
    Regards,
    event

  3. #3
    Registered User
    Join Date
    10-23-2012
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Remove duplicates and consolidate data in duplicated fields.

    Superb work but can you do it so that it also pulls out all the "non duplicates" rows as well to column G??? (ie all those rows that just have an existing unique mobile) i.e Mimi , Mel, etc in the spreadshete

  4. #4
    Valued Forum Contributor
    Join Date
    11-15-2008
    Location
    ph
    MS-Off Ver
    2007/2010/2016
    Posts
    479

    Re: Remove duplicates and consolidate data in duplicated fields.

    Hi -

    As you can see, it pull also the single record (no duplicates) and put in column G as well.

    Regards,
    event

  5. #5
    Registered User
    Join Date
    10-23-2012
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Remove duplicates and consolidate data in duplicated fields.

    HI, If you kindly look in original sheet attached there is also records for names like "Mimi" and "Mel" etc that have no duplicate mobile numbers. I would like to have those in column G as well Sirs (As well as what you have done already)

  6. #6
    Valued Forum Contributor
    Join Date
    11-15-2008
    Location
    ph
    MS-Off Ver
    2007/2010/2016
    Posts
    479

    Re: Remove duplicates and consolidate data in duplicated fields.

    Hi -

    Please send a new file after running the script and note what portion you need to add.

    Regards,
    event

  7. #7
    Registered User
    Join Date
    10-23-2012
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    6

    Red face Re: Remove duplicates and consolidate data in duplicated fields.

    Hi.... I have attached SAMPLE FILE 2.... It shows the other mobile numbers (examples in yellow) that dont have any duplicates... I would need all these as well Sirs in column G.
    Attached Files Attached Files

  8. #8
    Valued Forum Contributor
    Join Date
    11-15-2008
    Location
    ph
    MS-Off Ver
    2007/2010/2016
    Posts
    479

    Re: Remove duplicates and consolidate data in duplicated fields.

    Hi -

    So you have run the code based on sheet2 data right? In this case, the way I see it, the data starts in row 3 while the first sheet starts in row 6.

    so you need to change the codes to start in row 3

    Please Login or Register  to view this content.
    Regards,
    event

  9. #9
    Registered User
    Join Date
    10-23-2012
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Remove duplicates and consolidate data in duplicated fields.

    Yes working superbly sir... if you provide an email I will send you something via Paypal as an appreciation

  10. #10
    Registered User
    Join Date
    10-23-2012
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Remove duplicates and consolidate data in duplicated fields.

    sent you something via paypal

+ 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