+ Reply to Thread
Results 1 to 11 of 11

Which Is Most Accurate ? Delete Dupe Rows Top to Bottom - or - Bottom to Top ?

  1. #1
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,014

    Which Is Most Accurate ? Delete Dupe Rows Top to Bottom - or - Bottom to Top ?

    .
    As the title asks ... would it result in more accurate results to delete duplicate rows from the Top Down or from the Bottom Up ?

    New rows of data are periodically added to the database to the first available empty row from the top down.

    A duplicate row of data could be entered sometime after as an effort to correct faulty data in the previous entry, resulting in two rows with
    identical data in Col A.

    So ..... focusing on Col A data only ... the intent of the macro is to delete the oldest of the two rows ... which at this point would be above
    the last entry. Example: entry one ... row 5 / entry two ... row 23

    I have two macros: #1 searches from the bottom up and deletes the newest entry. #2 search from the top down and deletes the oldest entry (this is the goal).


    Will it be 100% accurate to use the macro that search from the top down ... or might there be errors at some point ?


    Thanks for looking.

  2. #2
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,908

    Re: Which Is Most Accurate ? Delete Dupe Rows Top to Bottom - or - Bottom to Top ?

    If you are 100% certain that the oldest data is always on top I'd say top to bottom.

    If that's not the case I would assume you need a second criteria to decide which row to delete.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  3. #3
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,014

    Re: Which Is Most Accurate ? Delete Dupe Rows Top to Bottom - or - Bottom to Top ?

    .
    Thank you bakerman

    I was told when performing a search (? or was that a sort, it's late and my mind is fuzzy) it is always better to start at the bottom and work up. If you start at the top and work down, Excel has a
    tendency to miss a row or two.

    My question was based on that same thought process.

    I've never seen any comment re: deleting ... if it made a difference.


    There are several websites that recommend only going from bottom to top and if necessary sort the rows first. That is an option but it adds
    one more thing to "go wrong". If possible I'd like to not sort first.

  4. #4
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,613

    Re: Which Is Most Accurate ? Delete Dupe Rows Top to Bottom - or - Bottom to Top ?

    How does your macro determine which row to delete? If you delete row 5 first, row 23 becomes row 22...
    Ben Van Johnson

  5. #5
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,908

    Re: Which Is Most Accurate ? Delete Dupe Rows Top to Bottom - or - Bottom to Top ?

    I wouldn't delete but ClearContents of the cells in Column A that needed to be removed and after that use SpecialCells to delete all Blank rows in 1 go.

  6. #6
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,014

    Re: Which Is Most Accurate ? Delete Dupe Rows Top to Bottom - or - Bottom to Top ?

    .
    Here is the macro currently used :

    Please Login or Register  to view this content.

    Comments / suggestions ?

  7. #7
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,014

    Re: Which Is Most Accurate ? Delete Dupe Rows Top to Bottom - or - Bottom to Top ?

    .
    Here is a representation of the data. You will notice there is a yellow highlighted cell A (first entry) and immediately below is the same row of data not highlighted (identical entry
    added after the original).

    I need to be able to delete the yellow highlighted row, leaving the newest entry in place.


    A
    B
    C
    D
    E
    F
    G
    H
    TY
    5
    Contract #
    Agency
    Contract Vehicle
    Project Name
    Subcontractor (Tier 2)
    Subcontractor (Tier 3)
    Job task / ECM
    LOCATION
    Date (MM/DD/YYY)
    6
    W#####-01-A-#### TO-0010
    GHI-12345
    UMCS
    Project 04
    Subcontractor 04
    Subcontractor 07
    6.01
    Mars
    2/3/2019
    7
    W#####-01-A-#### TO-0009
    JKL-12345
    UESC
    Project 07
    Subcontractor 09
    Subcontractor 11
    4.03
    Mars
    2/23/2019
    8
    W#####-01-A-#### TO-0009
    JKL-12345
    UESC
    Project 07
    Subcontractor 09
    Subcontractor 11
    4.03
    Mars
    2/23/2019
    9
    W#####-01-A-#### TO-0011
    JKL-12345
    UESC
    Project 07
    Subcontractor 09
    Subcontractor 11
    4.03
    Saturn
    2/27/2019
    10
    W#####-01-A-#### TO-0012
    ABC-12344
    ESPC
    Project 01
    Subcontractor 01
    Subcontractor 02
    3.02
    Neptune
    2/29/2019


    The yellow color is provided for clarification purposes and does not appear in the original.

  8. #8
    Valued Forum Contributor
    Join Date
    11-04-2018
    Location
    Denpasar
    MS-Off Ver
    Excel 2010
    Posts
    777

    Re: Which Is Most Accurate ? Delete Dupe Rows Top to Bottom - or - Bottom to Top ?

    I think if you always fill the first dupe cell with a certain/consistent color (such as your example is yellow),
    then maybe you can try to loop to each cell in column A and if the cell is yellow, then delete entire row.
    The yellow color is provided for clarification purposes and does not appear in the original.
    Sorry I misunderstand you as I don't see your last sentence
    Last edited by karmapala; 02-28-2019 at 02:07 PM.

  9. #9
    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: Which Is Most Accurate ? Delete Dupe Rows Top to Bottom - or - Bottom to Top ?

    If you start at the top and work down, Excel has atendency to miss a row or two.
    That's not an Excel thing, it's a programming logic error.

    RemoveDuplicates saves the first instance, backwards of what you want. Try this, which reverses the order, removes duplicates, and then restores the order.

    Please Login or Register  to view this content.
    Last edited by shg; 02-28-2019 at 07:17 PM. Reason: Specify no header on remove dups
    Entia non sunt multiplicanda sine necessitate

  10. #10
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,014

    Re: Which Is Most Accurate ? Delete Dupe Rows Top to Bottom - or - Bottom to Top ?

    .
    shg

    I was wondering about sorting the data first but had not implemented it.

    Thank you for the solution. Works great !

    Thanks to everyone for contributing.

    Cheers.

  11. #11
    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: Which Is Most Accurate ? Delete Dupe Rows Top to Bottom - or - Bottom to Top ?

    You're welcome. The one line should have added

    Please Login or Register  to view this content.
    Last edited by shg; 02-28-2019 at 06:09 PM.

+ 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] Return Row no. for Lookup from bottom of range, ignoring bottom n no. of rows
    By naira in forum Excel Formulas & Functions
    Replies: 17
    Last Post: 12-27-2018, 12:07 AM
  2. Lookup from bottom of range, ignoring bottom n no. of rows
    By naira in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 12-05-2018, 04:26 AM
  3. [SOLVED] Delete rows from the bottom up
    By madsklavsen in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 07-12-2016, 06:54 PM
  4. [SOLVED] Rows copying from bottom to top. need to copy top to bottom.
    By jafvortex93 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-01-2015, 02:07 PM
  5. Draw bottom border on every rows from top to bottom
    By tantcu in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-08-2013, 09:52 AM
  6. [SOLVED] loop col. A, start at bottom, pull contents of cell into msgbox, user input, dupe,&again
    By krackaberr in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-05-2013, 03:07 PM
  7. delete bottom 6 rows
    By adam2308 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-01-2009, 07:52 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