+ Reply to Thread
Results 1 to 4 of 4

Delete Rows using multiple criteria

  1. #1
    Registered User
    Join Date
    01-06-2011
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2003
    Posts
    2

    Delete Rows using multiple criteria

    I've scoured the forums and couldn't find exactly what I'm looking for...

    I would like to delete rows that have identical entries in 3 columns, and keep the row based on a criteria in the 4th column. Here's a simplified table/example of what I mean:

    Name Building Suite Expiry Date
    ABC Building 1 200 11/30/2011
    ABC Building 1 200 11/30/2015
    ABC Building 1 800 11/30/2011
    XYZ Building 2 200 5/31/2011
    XYZ Building 2 200 4/30/2013
    XYZ Building 2 200 3/31/2018


    So I would like to delete rows with a duplicate name, building and suite, BUT keep the row with the latest expiry date.

    In the end, there should only be 3 entries:

    Name Building Suite Expiry Date
    ABC Building 1 200 11/30/2015
    ABC Building 1 800 11/30/2011
    XYZ Building 2 200 3/31/2018


    Thank you in advance for the help. Keep up the good work here.

    -M

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: Delete Rows using multiple criteria

    Hi Markhao and welcome to the forum,

    Your problem is pretty easy using newer versions of Excel but much harder with Excel 2003.
    Have you considered upgrading?

    In the newer versions you would sort the data with the newest dates on top. They you would do a delete duplicates and only select the 3 columns, leaving the date out. Easy Peasy with a newer version.

    I'm stuck on doing it with a 2003 version. I'm thinking you will need helper rows after sorting by date. One of the forum guru's will find a way. Upgrade? Excel 2010 is pretty sweet!

    Maybe there was a way to delete dups in 2003!!?? Read http://office.microsoft.com/en-us/ex...001034626.aspx
    Last edited by MarvinP; 01-06-2011 at 01:46 PM.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Registered User
    Join Date
    01-06-2011
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: Delete Rows using multiple criteria

    Thanks for the reply. That option on Excel 2010 sounds very convenient, but unfortunately I'm stuck on the 2003 version.

    I've tried different ways to sort, but I think the only way is through VBA code...

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Delete Rows using multiple criteria

    This should do it for you, assuming the data is in A:D, titles in row1, data in row2 and down:

    Please Login or Register  to view this content.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

+ 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