+ Reply to Thread
Results 1 to 8 of 8

Remove row based on contents

  1. #1
    Forum Contributor
    Join Date
    04-06-2009
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    103

    Remove row based on contents

    Hi there

    I have a list of account numbers in column A and values in column B. There are two entries for each account number.

    Eg,

    Row 1 = Account1
    Row 2 = Account1
    Row 3 = Account2
    Row 4 = Account2

    I need to delete the entire row for the 2nd entry of each Account number.
    I have attached a sheet to demonstrate.

    In the example below it's by coincidence that the 2nd entry for each account is "0". This will not always be the case.

    Any help would be great
    Thanks
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor rwgrietveld's Avatar
    Join Date
    09-02-2008
    Location
    Netherlands
    MS-Off Ver
    XL 2007 / XL 2010
    Posts
    1,671

    Re: Remove row based on contents

    Make headers in col A,B,C
    Put this in C2: =COUNTIF($A$2:A2,"="&A2)=1, drag down
    Filter col C on FALSE
    Select visible cells only
    Press Del
    Sort on column A
    Attached Files Attached Files
    Looking for great solutions but hate waiting?
    Seach this Forum through Google

    www.Google.com
    (e.g. +multiple +IF site:excelforum.com/excel-general/ )

    www.Google.com
    (e.g. +fill +combobox site:excelforum.com/excel-programming/ )

    Ave,
    Ricardo

  3. #3
    Forum Contributor
    Join Date
    04-06-2009
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    103

    Re: Remove row based on contents

    Hi there

    Thanks for reply
    Is there a way in which I could put this into a macro. The problem I would have is that the length of the data is not always the same.... thanks

  4. #4
    Valued Forum Contributor rwgrietveld's Avatar
    Join Date
    09-02-2008
    Location
    Netherlands
    MS-Off Ver
    XL 2007 / XL 2010
    Posts
    1,671

    Re: Remove row based on contents

    Funny, just discussed that in another link. This is what JonvdHeyden made
    Please Login or Register  to view this content.
    Last edited by rwgrietveld; 02-18-2010 at 12:10 PM. Reason: Incomplete code added the Formula in Col C

  5. #5
    Forum Contributor
    Join Date
    04-06-2009
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    103

    Re: Remove row based on contents

    Hi again, thanks for that!

  6. #6
    Forum Contributor
    Join Date
    04-06-2009
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    103

    Re: Remove row based on contents

    Hi again,

    Hope you don't mind but I have another question. At the moment the macro/forumla is returning the first entry for each account. Is there a way in which it can be changed to return the last entry. Eg,

    A B
    Account1 500
    Account1 200
    Account1 50

    Then only the "50" row would be remain and the others would get deleted

    Thanks
    Last edited by uncleslinky; 02-22-2010 at 03:56 AM.

  7. #7
    Forum Contributor
    Join Date
    04-06-2009
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    103

    Re: Remove row based on contents

    edit (posted by mistake, sorry)
    Attached Files Attached Files

  8. #8
    Valued Forum Contributor rwgrietveld's Avatar
    Join Date
    09-02-2008
    Location
    Netherlands
    MS-Off Ver
    XL 2007 / XL 2010
    Posts
    1,671

    Re: Remove row based on contents

    This is simply adjusted by changing this line
    Please Login or Register  to view this content.
    into
    Please Login or Register  to view this content.

+ 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