+ Reply to Thread
Results 1 to 8 of 8

Replace any Non-Numeric CELLS i.e. Entire Contents with a Zero in a Specified Range

  1. #1
    Registered User
    Join Date
    11-03-2008
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    2,521

    Replace any Non-Numeric CELLS i.e. Entire Contents with a Zero in a Specified Range

    Dear Forum,

    I receive data from an external source where there are certain cells which contain Alpa-Numeric entries which can be anything other than numbers such as Alphabets and WildCard Characters , these cells need to contain only Numeric Entries and nothing other than numbers.

    Now as these can contain anything and everything its difficult to Replace the same with a Zero.
    I was looking for some code to FIND anything other than the numbers from 0 to 9 or any number with zero.

    I have a small code however this does not work as I need to have NOT Condition which I am unable to employ.

    Please Login or Register  to view this content.
    Can someone please help me on the above requirement.

    Thanks and Regards
    e4excel

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2404 Win 11 Home 64 Bit
    Posts
    23,855

    Re: Replace any Non-Numeric CELLS i.e. Entire Contents with a Zero in a Specified Range

    Please read the yellow banner at the top of this page on how to attach a file.

    Are you still using XL2007 or have your upgraded to a later version. If later, then please adjust your profile so that we can use the latest techniques.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Registered User
    Join Date
    11-03-2008
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    2,521

    Re: Replace any Non-Numeric CELLS i.e. Entire Contents with a Zero in a Specified Range

    I am using Excel 2007 at Work and Excel 2010 at Home.
    I have uploaded the attachment with a RANDOM CODE to add any wild card character which needs to be replaced with a zero or blank but the entire cell and not just the character.
    This is an example of how the data is received so just created a mock example using the RANDBETWEEN and CHAR...

    I only want the cells to contain numbers and nothing else.
    Attached Files Attached Files
    Last edited by e4excel; 11-29-2020 at 12:22 PM.

  4. #4
    Registered User
    Join Date
    11-03-2008
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    2,521

    Re: Replace any Non-Numeric CELLS i.e. Entire Contents with a Zero in a Specified Range

    This would have been really easier had i known the junk values but alas everytime its different so I thought that the WHITELISTING Concept would be be the best bet where I could only provide the limited list of elements which I need rather than focus on whats not required however I am unable to create the code for the same....

  5. #5
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Replace any Non-Numeric CELLS i.e. Entire Contents with a Zero in a Specified Range

    Hi, e4excel,

    what about trying SpecialCells like

    Please Login or Register  to view this content.
    which should take care of any text in any cell in the given area.

    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  6. #6
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Replace any Non-Numeric CELLS i.e. Entire Contents with a Zero in a Specified Range

    Hi, e4excel,

    sorry but that was none of my best ideas as I found out afterwards.

    Please try this sniplet instead:

    Please Login or Register  to view this content.
    Ciao,
    Holger

  7. #7
    Registered User
    Join Date
    11-03-2008
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    2,521

    Re: Replace any Non-Numeric CELLS i.e. Entire Contents with a Zero in a Specified Range

    Thanks you so much Holger......You dont know how much this is going to save my time...

  8. #8
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,516

    Re: Replace any Non-Numeric CELLS i.e. Entire Contents with a Zero in a Specified Range

    Quote Originally Posted by e4excel View Post
    I receive data from an external source where there are certain cells which contain Alpa-Numeric entries which can be anything other than numbers such as Alphabets and WildCard Characters , these cells need to contain only Numeric Entries and nothing other than numbers.

    Now as these can contain anything and everything its difficult to Replace the same with a Zero.
    I was looking for some code to FIND anything other than the numbers from 0 to 9 or any number with zero.
    Not really sure though.
    Please Login or Register  to view this content.
    Last edited by jindon; 11-30-2020 at 09:42 AM.

+ 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] Find and Replace value deletes entire cell contents
    By patb in forum Excel General
    Replies: 5
    Last Post: 09-25-2018, 10:27 AM
  2. Replace non numeric cells with a 0
    By cmb80 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-05-2017, 06:37 AM
  3. [SOLVED] Delete range contents after last numeric cell
    By Villalobos in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-16-2016, 05:11 PM
  4. Macro to replace numeric cells with another value
    By jeffrys in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 01-22-2014, 09:43 AM
  5. Find & Replace Entire Cell Contents
    By dwhite30518 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-01-2013, 12:39 AM
  6. Replies: 0
    Last Post: 09-23-2010, 07:01 PM
  7. Replies: 0
    Last Post: 09-23-2010, 06:39 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