+ Reply to Thread
Results 1 to 8 of 8

Delete the row - but only if certain cells are blank

  1. #1
    Registered User
    Join Date
    04-27-2017
    Location
    New York
    MS-Off Ver
    MS 365 v2211
    Posts
    85

    Delete the row - but only if certain cells are blank

    Hello,

    This is my first post here. This community seems very helpful from some of the searches I have done recently.

    I have a very large Excel spreadsheet and I need to sift through the data and delete certain rows. Let's say the spreadsheet has 10 columns. I only want to delete rows that contain empty cells from two specific columns. If cells from one or both columns contain data, the entire row must remain.

    Basically: [Delete entire row if cells from columns 1 and 2 are blank]

    Is there an efficient way to delete these specific rows?

    Thank you,
    Rook
    Last edited by RookA1; 04-28-2017 at 03:22 PM.

  2. #2
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Delete the row - but only if certain cells are blank

    Select all your data, let's say A1:Z3000

    Activate the filter (Home > Sort & Filter > Filter) or (Data>Filter)
    Then Let's say you want to delete all rows where C and R are blank
    Filter those two columns for blanks, then delete those rows

    Does that work for you?
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Registered User
    Join Date
    04-27-2017
    Location
    New York
    MS-Off Ver
    MS 365 v2211
    Posts
    85

    Re: Delete the row - but only if certain cells are blank

    Thank you for the quick reply, Chemist.

    I have to step away from my computer, but I'll give this is a closer look next log on. In order to avoid deleting blanks when just C (or just R) have a blank cell, I should use the Ctrl key to and filter them at the same time, right?

  4. #4
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Delete the row - but only if certain cells are blank

    No need to use the control key. Filter one, then the other. Only rows where both are blank will be showing.

  5. #5
    Registered User
    Join Date
    04-27-2017
    Location
    New York
    MS-Off Ver
    MS 365 v2211
    Posts
    85

    Re: Delete the row - but only if certain cells are blank

    Chem, I'm having a hard time getting this to work correctly. It seems like some non-blank cells make it through my efforts to filter. Are there any other ways to do this?

  6. #6
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Delete the row - but only if certain cells are blank

    If you have selected all of your data prior to applying the filter, no blank rows will make it through your filter.

    See attached.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    04-27-2017
    Location
    New York
    MS-Off Ver
    MS 365 v2211
    Posts
    85

    Re: Delete the row - but only if certain cells are blank

    Thank you for the attached file. Using a simple example help me to extrapolate the principle to my several thousand row spreadsheet.

    Edit: I forgot to mention that I suspect my problem with the filter feature yesterday was the result of miscellaneous blank rows within my data set. It seems like they somehow were interfering with the filtering.
    Last edited by RookA1; 04-28-2017 at 03:33 PM. Reason: added information

  8. #8
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Delete the row - but only if certain cells are blank

    What often happens when there are miscellaneous blank rows is that the entire range of rows is not filtered. It's important to select the entire range before engaging a fillter, otherwise Excel picks the range down to that first blank row.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Delete first 3 blank cells
    By tsakta13ole in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 04-21-2016, 11:26 AM
  2. Delete Cells with Specific Value and All Blank Cells Until Next Populated Cell is Checked
    By rdtrahan1906 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-26-2014, 05:50 PM
  3. vba delete blank cells in range B:B,J:J,O:O so as not affect next column values cells.
    By breadwinner in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-14-2014, 10:44 PM
  4. [SOLVED] Delete special blank cells not recognising blank cells
    By anrichards22 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 11-04-2013, 03:54 AM
  5. [SOLVED] Delete Row for all blank cells up to last row used
    By Pho6 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 09-14-2013, 08:06 AM
  6. Replies: 2
    Last Post: 07-25-2013, 01:01 PM
  7. [SOLVED] Macro to delete blank cells and unwanted cells in a particular column
    By Nikkishr in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 11-09-2012, 06:22 PM

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