+ Reply to Thread
Results 1 to 6 of 6

Remove spaces before and after parenthesis and hash

Hybrid View

  1. #1
    Registered User
    Join Date
    03-07-2013
    Location
    zurich
    MS-Off Ver
    Excel 2010
    Posts
    99

    Remove spaces before and after parenthesis and hash

    Hello to all forum member

    In attached sheet, I want to to remove single or multiple spaces before and after symbol like hash (#) and parenthesis (left, right),
    I used trim function but it is not working.

    Time format are there next to date with one space. I don't want to touch that part one.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    12-03-2009
    Location
    Florence, Italy
    MS-Off Ver
    Excel 2019
    Posts
    1,796

    Re: Remove spaces before and after parenthesis and hash

    Hi,

    please see the file attached

    =SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A2," # ","#")," (","("),"# ","#")," #","#")
    There are for sure better (and more elegant) solutions

    Regards
    Attached Files Attached Files
    -----------------------------------------------------

    At Excelforum, you can say "Thank you!" by clicking the star icon ("Add Reputation") below the post.

    Please, mark your thread [SOLVED] if you received your answer.

  3. #3
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Remove spaces before and after parenthesis and hash

    try
    =iferror(SUBSTITUTE(SUBSTITUTE(REPLACE(A6,FIND(":",A1)-3,1,"^")," ",""),"^"," "),substitute(A1," ",""))
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  4. #4
    Registered User
    Join Date
    12-01-2013
    Location
    India
    MS-Off Ver
    2003 / 2007 / 2010
    Posts
    2

    Thumbs up Re: Remove spaces before and after parenthesis and hash

    Space Delimiter.xlsm

    Hope this macro works fine for this.

  5. #5
    Registered User
    Join Date
    03-07-2013
    Location
    zurich
    MS-Off Ver
    Excel 2010
    Posts
    99

    Re: Remove spaces before and after parenthesis and hash

    Thanks to both of you.

  6. #6
    Registered User
    Join Date
    03-07-2013
    Location
    zurich
    MS-Off Ver
    Excel 2010
    Posts
    99

    Re: Remove spaces before and after parenthesis and hash

    Thanks Nagarajan.

    Suppose I want to use this macro on 3 columns (I, J, K) of sheet1. Can you please help me updating the macro

+ 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. Replies: 7
    Last Post: 03-03-2016, 11:38 AM
  2. remove value inside parenthesis visual basic
    By paynod in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-13-2012, 08:24 AM
  3. remove data in parenthesis
    By HuskerBronco in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-24-2008, 03:48 PM
  4. How To Remove Spaces?
    By Dno in forum Excel General
    Replies: 4
    Last Post: 12-21-2006, 06:53 PM
  5. [SOLVED] How do I remove spaces
    By lovebaby in forum Excel General
    Replies: 5
    Last Post: 10-29-2005, 12:05 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