+ Reply to Thread
Results 1 to 7 of 7

Remove Duplicates not working consistently

  1. #1
    Registered User
    Join Date
    03-15-2010
    Location
    CT
    MS-Off Ver
    Excel 2010
    Posts
    72

    Remove Duplicates not working consistently

    I have an issue where Remove Duplicates is not functioning as expected. I have 2 files: Source.xlsx and Calculation.xlsx

    I am copying data from the Source.xlsx via VBA:
    Please Login or Register  to view this content.
    I am then removing duplicates from the copied data via VBA:
    Please Login or Register  to view this content.
    all data is being copied from Source.xlsx to Calculation.xlsx

    my findings thus far:
    1. there are still duplicates in Calculation.xlsx after running VBA code
    2. duplicates are all removed as intended from Source.xlsx if I run the remove duplicates VBA code
    3. the duplicates exist when I manually remove duplicates from Calculation.xlsx
    4. duplicates are all removed as intended from Source.xlsx if I manually remove duplicates
    5. if I run the VBA code (leaving duplicates as in step 1) then sort the data in Calculation.xlsx and then manually remove duplicates, the duplicates are removed correctly.
    6. if I Step by Step run the VBA macro and manually sort the imported data before the VBA Duplicate removal code runs, then allow the VBA code to run, duplicates remain.

    By the Numbers:
    1. Source.xlsx: 341,392 lines
    2. Remove duplicates in source file (manually and via VBA) leaves 27,189 lines
    3. Calculation.xlsx after data transfer: 341,392 lines
    4. After VBA code runs: 27,313 lines
    5. After sorting data and manually removing duplicates: 27,189 lines
    6. After Step by Step running code, sorting data prior to remove duplicates VBA code running: 37,134 lines

    the 27,189 figure was confirmed by sorting data and doing a line by line comparison
    Please Login or Register  to view this content.
    this was then added together, resulting in 0 duplicates.

    any ideas on why the VBA isn't working in Calculations.xlsx? or why manual removal isn't working either unless the data is sorted?
    Last edited by SUPPO_USN; 07-24-2017 at 03:57 PM.

  2. #2
    Registered User
    Join Date
    03-15-2010
    Location
    CT
    MS-Off Ver
    Excel 2010
    Posts
    72

    Re: Remove Duplicates not working consistently

    ok, so still no idea why it's not working, but the below code gets me to where all duplicates are removed:
    Please Login or Register  to view this content.
    As you can see, the only thing I'm doing is sorting the data ascending, then descending with a remove duplicates between each sort. Why isn't remove duplicates catching everything the first time through? order shouldn't matter.

    Is the remove duplicates functionality broken? Is there another way to remove duplicates vice "Data -> Remove Duplicates" in Excel 2010?

    I've been using this method for a while now to manipulate data, now I'm wondering if I now have to take extra steps to verify my data since I don't think I can trust this any longer...

  3. #3
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Remove Duplicates not working consistently

    Is the data a mix of numbers and text?
    Entia non sunt multiplicanda sine necessitate

  4. #4
    Registered User
    Join Date
    03-15-2010
    Location
    CT
    MS-Off Ver
    Excel 2010
    Posts
    72

    Re: Remove Duplicates not working consistently

    It is a mixture of Numeric and Alphanumeric data.

  5. #5
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Remove Duplicates not working consistently

    It's a bug. Sort first, then remove duplicates.

  6. #6
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Remove Duplicates not working consistently

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    03-15-2010
    Location
    CT
    MS-Off Ver
    Excel 2010
    Posts
    72

    Re: Remove Duplicates not working consistently

    ok. just weird that it removes them all as it should in the original file, but when I copy the values over to another sheet, it doesn't work correctly.

+ 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] Remove duplicates - CountIf / SumProduct not working
    By luislffm in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-13-2017, 12:48 PM
  2. [SOLVED] IFERROR not (consistently) working
    By John 1978 in forum Excel Formulas & Functions
    Replies: 19
    Last Post: 04-26-2017, 03:04 AM
  3. Private is not working consistently
    By rhouston08 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-24-2016, 12:44 PM
  4. [SOLVED] remove duplicates not working does not rmove all
    By cfinch100 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-05-2015, 08:35 AM
  5. [SOLVED] COUNTIF not working consistently
    By bishoposiris in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-22-2014, 11:09 AM
  6. Remove Duplicates Not Working!
    By walle786 in forum Excel General
    Replies: 8
    Last Post: 03-24-2013, 12:37 PM
  7. [SOLVED] VLookup not working consistently
    By pjw23 in forum Excel General
    Replies: 2
    Last Post: 04-27-2012, 03:45 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