+ Reply to Thread
Results 1 to 8 of 8

Delete rows that do not contain specific text

Hybrid View

jahburt Delete rows that do not... 10-03-2012, 01:02 PM
patel45 Re: Delete rows that do not... 10-03-2012, 01:18 PM
jahburt Re: Delete rows that do not... 10-03-2012, 01:33 PM
djfscouse Re: Delete rows that do not... 10-03-2012, 01:55 PM
jahburt Re: Delete rows that do not... 10-03-2012, 02:31 PM
JBeaucaire Re: Delete rows that do not... 10-03-2012, 02:47 PM
jahburt Re: Delete rows that do not... 10-03-2012, 03:25 PM
JBeaucaire Re: Delete rows that do not... 10-03-2012, 04:14 PM
  1. #1
    Registered User
    Join Date
    08-09-2012
    Location
    Milford, MA
    MS-Off Ver
    Excel 2007
    Posts
    4

    Delete rows that do not contain specific text

    I have a large spreadsheet for tracking missing documents in employee files. I would like to delete all rows that do not contain the text "missing" in any of the columns.

  2. #2
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Delete rows that do not contain specific text

    can you attach a sample file ?
    If solved remember to mark Thread as solved

  3. #3
    Registered User
    Join Date
    08-09-2012
    Location
    Milford, MA
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Delete rows that do not contain specific text

    Sample_missing.xlsx

    This is just a small sample. The actual spreadsheet has about 400 rows. I want to view just the rows with the word "missing" without having to individually delete all the others row by row. Thanks

  4. #4
    Forum Contributor
    Join Date
    07-31-2012
    Location
    Los Angeles, USA
    MS-Off Ver
    2003, 2010, 365
    Posts
    323

    Re: Delete rows that do not contain specific text

    Hi,

    Try this it may help.

    Sub DeleteRows1()
      Dim i As Long
      Application.ScreenUpdating = False
      For i = Cells(Rows.Count, "C").End(xlUp).Row To 1 Step -1
        If Cells(i, "C").Value <> "missing" Then Cells(i, "C").EntireRow.Delete
      Next i
    End Sub
    David
    Last edited by djfscouse; 10-03-2012 at 02:21 PM. Reason: correcting code

  5. #5
    Registered User
    Join Date
    08-09-2012
    Location
    Milford, MA
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Delete rows that do not contain specific text

    That is deleting all the rows. I'm trying to get the rows that contain the work "missing" to be the only rows left. Thanks

  6. #6
    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 that do not contain specific text

    Without VBA, to see only the rows that have "missing" somewhere on the row:

    1) In AO1, put "Key"

    2) In AO2 put this formula: =COUNTIF(A2:AN2, "Missing") > 0

    3) Copy AO2 down the whole data set

    4) Click Data > Filter to turn on the Autofilter

    5) Click on AO1 and use the filter to see TRUE only


    Done. The other rows are hidden, you can work with the "missing" rows and then turn off the autofilter when done.
    _________________
    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!)

  7. #7
    Registered User
    Join Date
    08-09-2012
    Location
    Milford, MA
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Delete rows that do not contain specific text

    Perfect! Thanks!

  8. #8
    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 that do not contain specific text

    I have marked this thread solved for you.
    In the future please select Thread Tools from the menu above and mark the thread as solved. Thanks.

+ 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