+ Reply to Thread
Results 1 to 5 of 5

remove / replace a string of digits with nothing

  1. #1
    Registered User
    Join Date
    07-16-2012
    Location
    Poland
    MS-Off Ver
    Excel 2007
    Posts
    10

    remove / replace a string of digits with nothing

    Hello all,

    I would appreciate any help with removing the following string from a sheet: semi-colon, hash, four (three, two or even one digit), semi-colon, hash.

    for example, change this string:

    NA;#154

    to look like this:

    NA

    or this string:

    PL;#178;#BY;#22;#CZ;#61;#EE;#73;#LV;#124;#LT;#130;#RU;#185;#SK;#201;#UA;#234

    to look like this:

    PL;BY;CZ;#EE;LV;LT;RU;SK;UA;

    This rule seems constant throughout the entire sheet. In the sample workbook attached, the string to be replaced is contained in row F only, but since the data is imported, the problematic string may be located in some other row. For this reason, it would be very convenient if the solution worked for the entire sheet.
    Attached Files Attached Files
    Last edited by ex2012; 02-21-2019 at 10:33 AM.

  2. #2
    Valued Forum Contributor
    Join Date
    11-02-2016
    Location
    NY
    MS-Off Ver
    2010
    Posts
    459

    Re: remove / replace a string of digits with nothing

    Can you use Find & Replace? in the FIND Box: NA;#??? REPLACE Box: NA ( you may need to add place holder ? if the string is longer/shorter than the 3 '?' in the search and replace. Use the Button "REPLACE ALL"

  3. #3
    Registered User
    Join Date
    07-16-2012
    Location
    Poland
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: remove / replace a string of digits with nothing

    Thanks for the tip.

    A number of replacements needs to be made additionally since the string with two or one digit still remains. Also, this replacement sometimes produces a missing text if the repetitions are not done in a certain sequence.

    After the first or second replacement, it is impossible to say if an importatnt piece of text gets deleted since there is far too many rows to check immediately. I hope this could be tested on a sample attached to my query.

  4. #4
    Valued Forum Contributor Haluk's Avatar
    Join Date
    02-14-2019
    Location
    Turkiye
    MS-Off Ver
    2010 - 64 Bit on Windows-11 (22 H2) 64 Bit
    Posts
    1,150

    Re: remove / replace a string of digits with nothing

    @ex2012:

    If you prefer a VBA solution, you can try the attached workbook where "Regular Expressions" method is used to fetch the required data.
    Attached Files Attached Files
    Last edited by Haluk; 02-21-2019 at 12:40 PM.

  5. #5
    Registered User
    Join Date
    07-16-2012
    Location
    Poland
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: remove / replace a string of digits with nothing

    Thanks, Haluk, this works like a charm

+ 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] Add digits to make string 10 digits
    By jscalem in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-14-2016, 05:55 PM
  2. [SOLVED] Find a series of digits within a string and replace
    By misha4334 in forum Excel General
    Replies: 8
    Last Post: 03-02-2015, 02:05 PM
  3. How to remove digits from the end of an alphanumeric string?
    By Uz123 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-05-2012, 09:16 PM
  4. Modify to Run On Specific Column and Remove trailing digits in string
    By pmterp in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 01-12-2012, 07:47 PM
  5. Replace 3 Digits with Letter
    By Scottmk in forum Word Programming / VBA / Macros
    Replies: 2
    Last Post: 11-11-2009, 07:07 PM
  6. how to remove first x digits and last y digits from a cell?
    By maixent in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 09-28-2009, 02:06 AM
  7. [SOLVED] Remove ' if not followed by two digits
    By tom in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-09-2006, 02:10 PM

Tags for this Thread

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