+ Reply to Thread
Results 1 to 6 of 6

Formula or VBA to remove BOTH records in column, not just one

  1. #1
    Forum Contributor
    Join Date
    08-21-2014
    Location
    London
    MS-Off Ver
    Office 365
    Posts
    232

    Formula or VBA to remove BOTH records in column, not just one

    Hi there,

    I'm using a solution in this thread http://www.excelforum.com/showthread.php?t=767947 as I have a lot of email addresses (700k), and I can remove duplictae funtcion BUT I want to remove the duplicate AND the original, to leave just the email addresses that occur once.

    I used the solution in the linked thread above;

    No, I would create a new column to filter on. Let's say your addresses are in A2:A5000, in E2 dragged down
    =COUNTIF($A$2:$A$5000,A2), then Filter on all values greater than 1 and delete those rows. Will that work for you?


    BUT on this many rows, it slows EXCEL right down.

    Is there;

    - a formula to flag those unique values OR
    - a VBA to extract them from the range

    or another suggestion.

    Thanks,

    Ian

  2. #2
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,426

    Re: Formula or VBA to remove BOTH records in column, not just one

    Sort the e-mail addresses (say column A)

    Leave A1 blank

    in B2

    =IF(A2<>A1,1,0)

    and drag down

    Filter on 1 and copy/paste column A to new sheet or new column

  3. #3
    Forum Contributor
    Join Date
    08-21-2014
    Location
    London
    MS-Off Ver
    Office 365
    Posts
    232

    Re: Formula or VBA to remove BOTH records in column, not just one

    Thanks - that highlights the doubles where 2 the same exist - and of course would leave ALL unique values in the column, as would the 'remove duplicates' function.

    What I want to do is remove BOTH where a pair of email address the same exist.

    That would leave, those that are NOT in both of my source lists which I have combined.

  4. #4
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,426

    Re: Formula or VBA to remove BOTH records in column, not just one

    Post a file as it is not clear what you are comparing.

  5. #5
    Forum Contributor
    Join Date
    08-21-2014
    Location
    London
    MS-Off Ver
    Office 365
    Posts
    232

    Re: Formula or VBA to remove BOTH records in column, not just one

    Okay - anonymous example attached.

    I have two lists of emails. One in column A, one in column D.

    I have put BOTH into column G and sorted by name A-Z.

    I know that there are 10 emails in List1 that are NOT in LIst2.

    I need a formula in column H, applying to column G which will;

    - see both parts of a duplicate pair, and either REMOVE both - leaving the 10 unique singles
    OR
    - flag in column H where a unique single occurs, meaning I can sort column H and just see the 10 unique emails that are in list 1 and not in list 2

    Needs to run on 700k email addresses.

    Hoping that's clearer, and thanks,

    Ian
    Attached Files Attached Files

  6. #6
    Forum Contributor
    Join Date
    08-21-2014
    Location
    London
    MS-Off Ver
    Office 365
    Posts
    232

    Re: Formula or VBA to remove BOTH records in column, not just one

    I've figured it out - the logic baffled me initially.

    I added the formula =IF(AND(G2<>G1, G2<>G3),"UNIQUE","PAIR") to cell H2.

    Attached is the resulting sheet, with a revised COUNT formula in I2.

    Ian
    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)

Similar Threads

  1. how to find the duplicate records or remove from an excel column
    By santbiju in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-21-2016, 09:52 AM
  2. Formula not based on range but when the records stop in column I
    By mcranda in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 06-27-2013, 11:00 AM
  3. Replies: 2
    Last Post: 03-07-2012, 02:13 PM
  4. Remove all but one instance of a value in one column based on records in another colu
    By TheCyrusVirus in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-20-2010, 11:31 AM
  5. Formula to count unique number of records in a column
    By stats09 in forum Excel General
    Replies: 3
    Last Post: 03-22-2010, 10:15 PM
  6. Remove duplicate records
    By CHAStats in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-19-2007, 06:16 PM
  7. Check and Remove Records
    By Madasamy in forum Excel General
    Replies: 3
    Last Post: 05-05-2006, 08:55 AM

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