+ Reply to Thread
Results 1 to 9 of 9

formula to remove /*! and extra space before and after text in cells

  1. #1
    Forum Contributor
    Join Date
    02-11-2014
    Location
    mauritius
    MS-Off Ver
    MS365
    Posts
    1,086

    formula to remove /*! and extra space before and after text in cells

    I have a column of data where there are spaces before the text and after with characters such as /!*1I.

    Looking a formula to clean the data columns eg France!/ to read France and son .

    As per sample file , I have shown some examples in columns B.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: formula to remove /*! and extra space before and after text in cells

    See the attached file.
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

  3. #3
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,000

    Re: formula to remove /*! and extra space before and after text in cells

    The best way to do this is with a series of nested SUBSTITUTE formulae, wrapped up inside a TRIM, like this:

    =TRIM(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(Tabel1[@ORIGIN],"/","")," I",""),"*",""),"!",""),"1",""))

    Note I used " I" and not "I"as that would have removed the I in Ireland. I would not have allowed that....
    Attached Files Attached Files
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  4. #4
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: formula to remove /*! and extra space before and after text in cells

    Try any of these two
    Formula: copy to clipboard
    Please Login or Register  to view this content.

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

    v A B
    1 ORIGIN Expected results
    2 Hongrie / Hongrie
    3 France France
    4 Italie Italie
    5 Allemagne / Allemagne
    6 Belgique! Belgiqu
    7 Belgique / Belgique
    8 Mande Mande
    9 Irlande Irlande
    10 Danemark / Danemark
    11 Saint-Marin / Saint-Marin
    12 espagne / espagne
    13 Rep. Tcheque I Rep. Tcheque
    14 Saint-Mann / Saint-Mann
    15 Pologne / Pologne
    16 Allernagne / Allernagne
    17 Espagne! Espagn
    18 Israel Israel
    19 Hongrie I Hongrie
    20 Espagne I Espagne
    21 Portugal / Portugal
    22 Rep. de Cone / Rep. de Cone
    23 Rep. de Colt* / Rep. de Colt
    24 Rep. de Coree / Rep. de Coree
    25 Portugal 1 Portugal
    26 Serbie Serbie
    27 Pays-Bas / Pays-Bas
    Last edited by AlKey; 09-16-2017 at 01:14 PM.
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  5. #5
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: formula to remove /*! and extra space before and after text in cells

    OR B2=LEFT(A2,LOOKUP(2,1/SEARCH(MID(SUBSTITUTE(SUBSTITUTE(A2&" "," I ","^^^"),"*","^"),ROW(INDIRECT("1:"&LEN(A2))),1),"abcdefghijklmnopqrstuvwxyz"),ROW(INDIRECT("1:50"))))
    Please Login or Register  to view this content.
    Try this and copy towards down
    Samba

    Say thanks to those who have helped you by clicking Add Reputation star.

  6. #6
    Forum Contributor
    Join Date
    02-11-2014
    Location
    mauritius
    MS-Off Ver
    MS365
    Posts
    1,086

    Re: formula to remove /*! and extra space before and after text in cells

    oeldere, Glenn, Alkey thank you all for the solutions provided

    All worked of them worked as charm.

  7. #7
    Forum Contributor
    Join Date
    02-11-2014
    Location
    mauritius
    MS-Off Ver
    MS365
    Posts
    1,086

    Re: formula to remove /*! and extra space before and after text in cells

    nflsales

    Thank you for your formula which worked as charm

  8. #8
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,000

    Re: formula to remove /*! and extra space before and after text in cells

    Thanks for the rep, Jean. Alkey has the best formula, I think, - so go with it...

  9. #9
    Forum Contributor shivya's Avatar
    Join Date
    08-19-2017
    Location
    Delhi, India
    MS-Off Ver
    2013
    Posts
    240

    Re: formula to remove /*! and extra space before and after text in cells

    =TRIM(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(Tabel1[@ORIGIN],"/"," "),"*"," "),"1"," "))

+ 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] Need to remove the space or extra line.
    By Sekars in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 08-06-2017, 01:35 AM
  2. [SOLVED] Extra space or spaces in Text in Forum Post. BB Code for extra space ?
    By Doc.AElstein in forum The Water Cooler
    Replies: 21
    Last Post: 03-02-2016, 02:59 PM
  3. Replies: 0
    Last Post: 08-19-2014, 11:02 AM
  4. [SOLVED] remove extra space after two words
    By parkkibum in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 04-05-2014, 09:00 AM
  5. How to remove an extra space at the end of the line?
    By EnCECU in forum Excel General
    Replies: 2
    Last Post: 03-01-2014, 04:37 PM
  6. Remove extra space from the end of the cell contain text
    By satputenandkumar0 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-31-2013, 09:55 AM
  7. Excel 2007 : Remove Extra Space
    By Jerseynjphillypa in forum Excel General
    Replies: 2
    Last Post: 11-08-2011, 12:09 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