+ Reply to Thread
Results 1 to 3 of 3

Delete lines with older date

  1. #1
    Registered User
    Join Date
    01-13-2011
    Location
    Belgium
    MS-Off Ver
    Excel 2003
    Posts
    2

    Unhappy Delete lines with older date

    I have a spreadsheet with 2 columns : ID and Date .

    Example :
    ID1 1/01/2010
    ID1 1/02/2010
    ID1 1/03/2010
    ID2 1/01/2011
    ID2 1/02/2011

    I need to have a list with only one line for each ID, namely the one with the most recent date :
    ID1 1/03/2010
    ID2 1/02/2011

    How can I delete the other records (the Excel file contains + 15.000 records) ?
    Attached Files Attached Files
    Last edited by VDREECK; 01-13-2011 at 10:27 AM.

  2. #2
    Forum Expert
    Join Date
    10-10-2008
    Location
    Northeast Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    2,387

    Re: Delete lines with older date

    VDREECK,

    Welcome to the Excel Forum.

    I assume that your data is in columns A and B, beginning in row 1, and that there are no titles in A1:B1.

    I use columns D and E as a work area.


    Please TEST this FIRST in a COPY of your workbook (always make a backup copy before trying new code, you never know what you might lose).


    1. Copy the below code, by highlighting the code and pressing the keys CTRL + C
    2. Open your workbook
    3. Press the keys ALT + F11 to open the Visual Basic Editor
    4. Press the keys ALT + I to activate the Insert menu
    5. Press M to insert a Standard Module
    6. Where the cursor is flashing, paste the code by pressing the keys CTRL + V
    7. Press the keys ALT + Q to exit the Editor, and return to Excel
    8. To run the macro from Excel, open the workbook, and press ALT + F8 to display the Run Macro Dialog. Double Click the macro's name to Run it.


    Please Login or Register  to view this content.

    Then run the DeleteDupsExceptLatestDate macro.
    Have a great day,
    Stan

    Windows 10, Excel 2007, on a PC.

    If you are satisfied with the solution(s) provided, please mark your thread as Solved by clicking EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

  3. #3
    Registered User
    Join Date
    01-13-2011
    Location
    Belgium
    MS-Off Ver
    Excel 2003
    Posts
    2

    Thumbs up Re: Delete lines with older date

    Quote Originally Posted by stanleydgromjr View Post
    VDREECK,

    Welcome to the Excel Forum.

    I assume that your data is in columns A and B, beginning in row 1, and that there are no titles in A1:B1.

    I use columns D and E as a work area.


    Please TEST this FIRST in a COPY of your workbook (always make a backup copy before trying new code, you never know what you might lose).


    1. Copy the below code, by highlighting the code and pressing the keys CTRL + C
    2. Open your workbook
    3. Press the keys ALT + F11 to open the Visual Basic Editor
    4. Press the keys ALT + I to activate the Insert menu
    5. Press M to insert a Standard Module
    6. Where the cursor is flashing, paste the code by pressing the keys CTRL + V
    7. Press the keys ALT + Q to exit the Editor, and return to Excel
    8. To run the macro from Excel, open the workbook, and press ALT + F8 to display the Run Macro Dialog. Double Click the macro's name to Run it.


    Please Login or Register  to view this content.

    Then run the DeleteDupsExceptLatestDate macro.
    Thanks a lot Stan, it does what it has to do

    Mark .

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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