+ Reply to Thread
Results 1 to 12 of 12

how remove all special characters except # , & - .

  1. #1
    Forum Contributor
    Join Date
    01-07-2014
    Location
    chennai,india
    MS-Off Ver
    Excel 2007
    Posts
    105

    how remove all special characters except # , & - .

    Hi

    i want to remove all special characters except # - & , and .


    Thanks.

  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: how remove all special characters except # , & - .

    This is the VBA method I use for this. First we add a new function to your workbook.

    Please Login or Register  to view this content.
    How to install the User Defined Function:
    1. Open up your workbook
    2. Get into VB Editor (Press Alt+F11)
    3. Insert a new module (Insert > Module)
    4. Copy and Paste in your code (given above)
    5. Get out of VBA (Press Alt+Q)
    6. Save as a macro-enabled workbook

    The function is installed and ready to use.


    To use it in a cell like any other formula like so:

    =CLEANSPECIAL(A1)

    The results will be only A-Za-Z0-9#-.
    Last edited by JBeaucaire; 01-13-2014 at 05:55 AM.
    _________________
    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 Contributor
    Join Date
    01-07-2014
    Location
    chennai,india
    MS-Off Ver
    Excel 2007
    Posts
    105

    Re: how remove all special characters except # , & - .

    Thank you for ur help..i need commas too

  4. #4
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: how remove all special characters except # , & - .

    An alternative approach:

    Please Login or Register  to view this content.
    let Source = #table({"Question","Thread", "User"},{{"Answered","Mark Solved", "Add Reputation"}}) in Source

    If I give you Power Query (Get & Transform Data) code, and you don't know what to do with it, then CLICK HERE

    Walking the tightrope between genius and eejit...

  5. #5
    Forum Contributor
    Join Date
    01-07-2014
    Location
    chennai,india
    MS-Off Ver
    Excel 2007
    Posts
    105

    Re: how remove all special characters except # , & - .

    how to run it after installing the above program

  6. #6
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: how remove all special characters except # , & - .

    Quote Originally Posted by JBeaucaire View Post
    How to install the User Defined Function:
    1. Open up your workbook
    2. Get into VB Editor (Press Alt+F11)
    3. Insert a new module (Insert > Module)
    4. Copy and Paste in your code (given above)
    5. Get out of VBA (Press Alt+Q)
    6. Save as a macro-enabled workbook

    The function is installed and ready to use.


    To use it in a cell like any other formula like so:

    =CLEANSPECIAL(A1)

    The results will be only A-Za-Z0-9#-.
    As explained...

    I named my function NotSpecial so in my case you would use:

    Formula: copy to clipboard
    Please Login or Register  to view this content.

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

    Re: how remove all special characters except # , & - .

    Take a look at the code. You'll see the line of code where we listed all the characters to include, highlighted in red in post #2. Add a comma in there.


    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

  8. #8
    Forum Contributor
    Join Date
    01-07-2014
    Location
    chennai,india
    MS-Off Ver
    Excel 2007
    Posts
    105

    Re: how remove all special characters except # , & - .

    but it removes spaces

  9. #9
    Forum Contributor
    Join Date
    01-07-2014
    Location
    chennai,india
    MS-Off Ver
    Excel 2007
    Posts
    105

    Re: how remove all special characters except # , & - .

    hi
    it shows error as compile error and variable not defined

  10. #10
    Forum Contributor
    Join Date
    01-07-2014
    Location
    chennai,india
    MS-Off Ver
    Excel 2007
    Posts
    105

    Re: how remove all special characters except # , & - .

    wherever the special characters are removed i want to fill that with single space

  11. #11
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: how remove all special characters except # , & - .

    I've amended my function, try this:

    Please Login or Register  to view this content.

  12. #12
    Forum Contributor
    Join Date
    01-07-2014
    Location
    chennai,india
    MS-Off Ver
    Excel 2007
    Posts
    105

    Re: how remove all special characters except # , & - .

    Thank you..it works

+ 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. How to remove special characters in a excel
    By Latha Mani in forum Excel General
    Replies: 6
    Last Post: 01-10-2014, 11:33 AM
  2. [SOLVED] Remove ALL Special Characters
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-14-2013, 08:12 PM
  3. Remove special characters
    By humacdeep in forum Excel General
    Replies: 6
    Last Post: 01-14-2012, 03:36 PM
  4. Remove Special Characters
    By bkatzman in forum Excel General
    Replies: 10
    Last Post: 04-13-2010, 11:51 AM
  5. Remove special characters from cell
    By jowilla442 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-21-2009, 01:01 AM

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