+ Reply to Thread
Results 1 to 4 of 4

Delete duplicates in one column, based on dates of another?

  1. #1
    Registered User
    Join Date
    08-24-2012
    Location
    Cincinnati
    MS-Off Ver
    Excel 2010
    Posts
    3

    Delete duplicates in one column, based on dates of another?

    I run a report and macro daily which part of consists of importing batch numbers and ship dates into a spreadsheet. More often than not, duplicate batches are imported, but the ship dates may vary. If a batch (545319 for example) is found multiple times with ship dates of 9/21/2012, 9/20/2012, and 9/24/2012, I would want the date furthest out from today to remain (9/24/2012), but delete the rows of the rest.

    Example of data:

    (Col. A) (Col. B)
    BATCH DATE
    507819 9/20/2012
    586502 9/20/2012
    584060 9/20/2012
    586002 9/20/2012
    583494 9/21/2012
    583494 9/21/2012
    585409 9/21/2012
    585409 9/21/2012
    585409 9/21/2012
    585409 9/21/2012
    585409 9/21/2012
    583523 9/21/2012
    578497 9/21/2012
    584872 9/21/2012
    584872 9/21/2012
    584755 9/21/2012
    584992 9/21/2012
    584992 9/21/2012
    583541 9/21/2012
    583541 9/21/2012
    583523 9/21/2012
    583523 9/21/2012
    585409 9/22/2012
    585409 9/22/2012
    585409 9/23/2012
    585409 9/23/2012
    577466 9/23/2012
    585095 9/23/2012
    585087 9/24/2012
    584753 9/24/2012
    578497 9/24/2012
    585630 9/24/2012
    583494 9/24/2012
    585410 9/24/2012

    Thank you in advance!

  2. #2
    Registered User
    Join Date
    08-24-2012
    Location
    Cincinnati
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Delete duplicates in one column, based on dates of another?

    Here is the current code for the import macro:

    Please Login or Register  to view this content.

  3. #3
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Delete duplicates in one column, based on dates of another?

    I see instances where there are duplicates, all having the same date 9/21, what should be done in this case?
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  4. #4
    Registered User
    Join Date
    08-24-2012
    Location
    Cincinnati
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Delete duplicates in one column, based on dates of another?

    Quote Originally Posted by arlu1201 View Post
    I see instances where there are duplicates, all having the same date 9/21, what should be done in this case?
    If there are duplicates and the dates are the same, then the duplicates should be deleted. Something like below if that helps.

    525525 9/20 #Delete
    525525 9/20 #Delete
    525525 9/20 #Delete
    525525 9/21 #Delete
    525525 9/21 #Delete
    525525 9/24 #Either one of these are ok, but keep only one.
    525525 9/24 " "

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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