+ Reply to Thread
Results 1 to 7 of 7

Delete rows which contain specific value in specific position within column

  1. #1
    Registered User
    Join Date
    02-28-2017
    Location
    Pennsylvania, USA
    MS-Off Ver
    2010
    Posts
    7

    Delete rows which contain specific value in specific position within column

    Hi all,

    I've provided a simplified example of what I'm trying to achieve. I would like to delete all rows that contain a "q" in the 2nd position of Column C. So in this example, that would be Columns 6,9,11, and 13. Any suggestions how to best achieve this? Thanks in advance!
    Attached Images Attached Images

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,462

    Re: Delete rows which contain specific value in specific position within column

    If there are only two characters in each cell, you could Filter on "ends with q" and delete the filtered/visible rows. If there are more characters, you could add a helper column. Use MID to test for q. Filter on the helper column. Again, delete the filtered/visible rows.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Delete rows which contain specific value in specific position within column

    Quote Originally Posted by TMS View Post
    If there are only two characters in each cell, you could Filter on "ends with q" and delete the filtered/visible rows. If there are more characters, you could add a helper column. Use MID to test for q. Filter on the helper column. Again, delete the filtered/visible rows.
    Instead of mid, you can use find =Find ("q", A2) for example will return the position in the string in cell A2 where it finds "q" or #N/A! if it doesn't. SO = ISNUMBER(FIND("q",A2)) will be true if A2 contains "q" and false if not.
    One spreadsheet to rule them all. One spreadsheet to find them. One spreadsheet to bring them all and at corporate, bind them.

    A picture is worth a thousand words, but a sample spreadsheet is more likely to be worked on.

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,462

    Re: Delete rows which contain specific value in specific position within column

    Not sure what the advantage would be, but the OP did say:
    that contain a "q" in the 2nd position of Column C.
    The FIND would pick up a "q" in any position, not just the second, unless I am mistaken.

  5. #5
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Delete rows which contain specific value in specific position within column

    Ah then = FIND("q",A2) = 2.

    I have to admit that I missed the requirement for second position. Mid would also work in that case.

  6. #6
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,462

    Re: Delete rows which contain specific value in specific position within column

    You'll need IFERROR to cater for the not present scenario.

  7. #7
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Delete rows which contain specific value in specific position within column

    Yup! Why use two formulas when one will do? So Mid wins this one.

+ 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 all rows in which column does not contain specific word
    By BVT3030 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-22-2015, 12:57 AM
  2. Delete Rows with specific text in specific column
    By love2waltz in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-12-2015, 10:16 AM
  3. [SOLVED] Copy rows with specific text in specific column into specific sheet
    By Valemaar in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 08-22-2014, 03:23 PM
  4. Delete rows with specific text in column
    By danieldaniel1 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-30-2013, 12:47 PM
  5. [SOLVED] delete rows when column has specific word(s)
    By chrisblackman in forum Excel Programming / VBA / Macros
    Replies: 19
    Last Post: 09-22-2013, 10:21 PM
  6. 2003 Delete rows with specific value in column C
    By koklok in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-15-2009, 12:08 PM
  7. Delete rows with specific column values
    By koklok in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-16-2008, 01:51 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