+ Reply to Thread
Results 1 to 11 of 11

Deleting Duplicates of Second Instance

  1. #1
    Registered User
    Join Date
    02-26-2016
    Location
    Monsey NY
    MS-Off Ver
    2012
    Posts
    15

    Deleting Duplicates of Second Instance

    Deleting Duplicates of Second Instance

    Home Phone Mobile Phone Ad Response
    (999) 999-9999 999-999-9999
    (999) 999-9999 999-999-9999
    (999) 999-9999 999-999-9999
    (999) 999-9999 999-999-9999
    (999) 999-9999 999-999-9999
    (999) 999-9999 999-999-9999
    (999) 999-9999 999-999-9999
    (999) 999-9999 (999) 999-9999 999-999-9999
    (999) 999-9999 (999) 999-9999 999-999-9999
    999) 999-9999 (999) 999-9999 999-999-9999


    I organize lectures and I advertise a hotline. Column A and Column B are in my outlook contacts. Column C is a response to an ad or called the hotline. If there are duplicates I want to delete the duplicate that is in column C. Notice that column C is a different format then Column A or Column B.

    I did this manually through the find all feature in excel. It was beautiful but very tedious. I would love to have an option to make it more automatic. Would anybody please point me in the right direction.

    Thanx so much.

  2. #2
    Forum Expert sourabhg98's Avatar
    Join Date
    10-22-2014
    Location
    New Delhi, India
    MS-Off Ver
    Excel 2007, 2013
    Posts
    1,899

    Re: Deleting Duplicates of Second Instance

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic
    Happy to Help

    How to upload excel workbooks at this forum - http://www.excelforum.com/the-water-...his-forum.html

    "I don't get things easily, so please be precise and elaborate"

    If someone's post has helped you, thank by clicking on "Add Reputation" below the post.
    If your query is resolved please mark the thread as "Solved" from the "Thread Tools" above.

    Sourabh

  3. #3
    Forum Expert
    Join Date
    05-20-2015
    Location
    Chicago, Illinois
    MS-Off Ver
    2016
    Posts
    2,103

    Re: Deleting Duplicates of Second Instance

    Sourabhg98 is right, it's hard to tell exactly what you're after. The procedure below works for me, based upon what I think you want. If the number in C matches any number in A or B, the C value will be deleted. It isn't clear from your post if the duplicate occurrences will always fall in the same row, so my procedure sweeps through all rows for each number in column C. This is the less efficient path, but it should still cover everything.

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    02-26-2016
    Location
    Monsey NY
    MS-Off Ver
    2012
    Posts
    15

    Re: Deleting Duplicates of Second Instance

    Hi. This is my first time so please excuse my questions. I am still trying to understand how to attach and upload files here. The original file that I tried uploading is:

    delete duplicates.jpg (I had no idea you were supposed to press upload so I kept exiting) I tried the paper clip but it just gives me a blank box. I don't know what to put in it.

    I do a mass phone blast when I have to publicize a lecture that I am organizing. I have 3 columns. The first 2 columns (Column A and Column B) are exported from my contacts in outlook. It is their home phone and mobile phone. If they don't have a home phone or a cell phone, the cell is blank. I need these columns to stay as is.

    It is the 3rd column (Column C) that I need to be edited because I add these numbers to the phone blast. These are the phone numbers of the people who call into the hotline. Some of them are members who are already in the contact list and some of them are not. Therefore I need the duplicates (the ones already in the outlook contacts) to be deleted from Column C only. Please note also that column C is in a different format because I copy and paste the called phone numbers straight from the hotline system's email into excel.

    I have tried to run the macro but received an error as you will see here: (I hope)

    compile error.jpg

    Please advise.
    Attached Images Attached Images

  5. #5
    Forum Expert
    Join Date
    05-20-2015
    Location
    Chicago, Illinois
    MS-Off Ver
    2016
    Posts
    2,103

    Re: Deleting Duplicates of Second Instance

    It looks like when you pasted my code into your window, it combined two lines into one. The line that's giving you the error should be two lines.

    Wrong:
    LastC = ActiveSheet.Cells(Rows.Count, 3).End(xlUp).Row LastB = ActiveSheet.UsedRange.Rows.Count


    Right:
    LastC = ActiveSheet.Cells(Rows.Count, 3).End(xlUp).Row
    LastB = ActiveSheet.UsedRange.Rows.Count

    Try fixing that and let me know if it works...

  6. #6
    Registered User
    Join Date
    02-26-2016
    Location
    Monsey NY
    MS-Off Ver
    2012
    Posts
    15

    Re: Deleting Duplicates of Second Instance

    Yes, you are right. I corrected it.

    But now that I am running it, I don't see anything happening. The duplicates are still there.

    What am I doing wrong.

  7. #7
    Forum Expert
    Join Date
    05-20-2015
    Location
    Chicago, Illinois
    MS-Off Ver
    2016
    Posts
    2,103

    Re: Deleting Duplicates of Second Instance

    Nothing at all is happening to the duplicates in C? It works on my efforts to mimic your data. Can you post a sample workbook?

  8. #8
    Registered User
    Join Date
    02-26-2016
    Location
    Monsey NY
    MS-Off Ver
    2012
    Posts
    15

    Re: Deleting Duplicates of Second Instance

    I don't have a sample, only the real thing. I am hesitant to post it as it could be seen by search engines. Is there another way I could send it, perhaps by email. [email protected]

    Thanx

  9. #9
    Forum Expert
    Join Date
    05-20-2015
    Location
    Chicago, Illinois
    MS-Off Ver
    2016
    Posts
    2,103

    Re: Deleting Duplicates of Second Instance

    Not a sample of the real thing, but an actual excel workbook with data/format that mimics the real thing. Above you've posted screenshots with number consisting entirely of nines. Can you post a workbook with 10 or so rows of more realistic fake numbers? I've attached the sample book I made for myself, on which the code appears to work. I'm trying to figure out why my results are differing from yours...
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    02-26-2016
    Location
    Monsey NY
    MS-Off Ver
    2012
    Posts
    15

    Re: Deleting Duplicates of Second Instance

    I apologize for taking such a long time to respond. I had previous obligations that I had to take care of. I ran the macro which resulted in the following. As you can see there are quite a few duplicates in column C. I sorted column C to make it easier. One thing I did want to ask is if it is possible to get rid of the duplicates that have a 1 in them as well. For example 1999-999-1234 is the same as 999-999-1234

    Thanx so much for your help.

    delete duplicates.jpg

    I will be happy to send an attachment, I just don't know how. I keep pressing the paper clip but only small blank box shows up and doesn't prompt me for anything. I tried dragging the file there but nothing happened.
    Attached Images Attached Images
    Last edited by cjamps; 03-06-2016 at 04:23 PM.

  11. #11
    Forum Expert
    Join Date
    05-20-2015
    Location
    Chicago, Illinois
    MS-Off Ver
    2016
    Posts
    2,103

    Re: Deleting Duplicates of Second Instance

    My previous procedure only searched columns A and B. I didn't realize you wanted to check C against itself. The procedure below should achieve that. I believe it will also remove the "1" at the start of any number in column C. Let me know if it works...

    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Add Duplicates and Save On Instance
    By hftechno in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-12-2014, 03:01 PM
  2. [SOLVED] Count duplicates and duplicates with suffix as one instance
    By ruraljur0r in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 03-24-2014, 12:38 AM
  3. Highlighting all duplicates except the last instance
    By bopsgtir in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-16-2013, 06:57 PM
  4. highlight all duplicates EXCEPT first instance
    By Blake 7 in forum Excel General
    Replies: 7
    Last Post: 04-27-2012, 01:33 AM
  5. Replies: 4
    Last Post: 04-18-2012, 03:33 AM
  6. Replies: 6
    Last Post: 03-29-2012, 12:16 AM
  7. keep n duplicates not just a single instance - how
    By TopDogDave in forum Excel General
    Replies: 1
    Last Post: 11-13-2010, 10:55 PM

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