+ Reply to Thread
Results 1 to 6 of 6

SOLVED: Clear Cells with Certain Values

  1. #1
    Registered User
    Join Date
    03-25-2011
    Location
    San Diego
    MS-Off Ver
    Excel 2003
    Posts
    6

    SOLVED: Clear Cells with Certain Values

    Hi everyone,

    This is probably easy but I have no VBA experience.

    All I want to do is clear cells within a range that contain the values "n/a" or "n/m". The range is columns C,D,E,F,G and go from row 2 to 29,423 (you can see why i don't want to do it manually).

    Thanks for any help!
    Last edited by tjohn909; 03-28-2011 at 01:10 PM.

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

    Re: Clear Cells with Certain Values

    This can be done with an empty column and a formula. Let's say column M...

    1) In M1 put "key"
    2) In M2 put this formula:

    =SUM(OR(--ISNUMBER(MATCH({"n/a","n/m"},C2:G2,0))))

    3) Copy that cell down the whole dataset to complete the key column.
    4) Select column M
    5) Turn on the Data > Filter > Autofilter
    6) Do a custom filter on that column for greater than: 0
    7) Highlight all the visible rows of data and delete them
    8) Turn off the Autofilter
    9) Clear column M
    _________________
    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!)

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

    Re: Clear Cells with Certain Values

    My apologies, you said clear CELLS, meaning no rows change, just cells empty?

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

    Re: Clear Cells with Certain Values

    Hi,
    No VBA needed.

    Select columns C:G and click on Ctrl+H, to bring up the Find and Replace dialog.

    Make sure you are looking for Values (not Formulas) and replace #N/A with "" and do the same with n/m.

    See if that does it for you.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  5. #5
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Clear Cells with Certain Values

    Why don't you just select Columns C:G then use Find/Replace

    Replace:= n/a
    Replace With:= (Leave blank)
    Replace All

    Same for n/m

    This code will do it for Columns C:G, (almost straight from the macro recorder)
    Please Login or Register  to view this content.

    If the Columns can change then change this line
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.

    Select the Required Columns and run the amended macro

    Hope this helps
    Last edited by Marcol; 03-28-2011 at 01:10 PM.
    If you need any more information, please feel free to ask.

    However,If this takes care of your needs, please select Thread Tools from menu above and set this topic to SOLVED. It helps everybody! ....

    Also
    اس کی مدد کرتا ہے اگر
    شکریہ کہنے کے لئے سٹار کلک کریں
    If you are satisfied by any members response to your problem please consider using the small Star icon bottom left of their post to show your appreciation.

  6. #6
    Registered User
    Join Date
    03-25-2011
    Location
    San Diego
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: SOLVED: Clear Cells with Certain Values

    Perfect. Thanks Everyone. didn't think of replace

+ 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