+ Reply to Thread
Results 1 to 6 of 6

Using the Replace to remove Spaces in a Number

  1. #1
    Registered User
    Join Date
    10-14-2010
    Location
    WI
    MS-Off Ver
    Excel 2007
    Posts
    77

    Question Using the Replace to remove Spaces in a Number

    Hello, This is a simple question as to why Excel does what it does dealing with the Replace feature. I have already found a solution on how to remove the spaces between numbers in a cell. The =Substitute(A1," ","") formula worked fine.

    What I want to know is why when I removed them using the Replace option, the numbers are all changed. No matter what format I choose the number would change after replacing all the spaces with nothing. This was very frustrating and I am inquiring about this as a way to ease my frustration on this topic. I will include an example of the numbers I am dealing with as well as the working formula. Please try to use the Replace feature and see if your results are any different then these made up numbers it have been giving me.

    Please feed me your knowledge.

    Thank You!
    Attached Files Attached Files
    Last edited by TWent; 05-25-2011 at 09:46 AM.

  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: Using the Replace to remove Spaces in a Number

    Leave the spaces in. You should be able to deal the Fuel Card strings as strings, much easier than trying the manhandle Excel's problems with numbers over 14 digits.
    Last edited by JBeaucaire; 05-05-2011 at 02:44 PM.
    _________________
    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
    Registered User
    Join Date
    10-14-2010
    Location
    WI
    MS-Off Ver
    Excel 2007
    Posts
    77

    Re: Using the Replace to remove Spaces in a Number

    Well the issue is that we use that file as an import into some automatic auditing software. The numbers need to match the ones in the program we use, this program does not allow spaces or dashes in the FuelCard entry. We need to make the import fit the programs format. This is why I have the issue with excel not letting me use the replace to simply remove the spaces. I do this same formula for many different files and I might just work on a macro to add the extra column and insert the formula.

    Thanks for the reply. I can mark this as solved if no one has a solution due to incapacitates of excel.

  4. #4
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326

    Re: Using the Replace to remove Spaces in a Number

    The issue is that SUBSTITUTE is a text function. The length of the resulting string may then be 256 characters ( or more in 2007?)

    If you use Ctrl+H to remove spaces, XL assumes the result is a number. It will then limit it to 15 significant digits and reverts to the scientific notation


    EDIT also have a look at http://support.microsoft.com/kb/65903
    Last edited by arthurbr; 05-09-2011 at 10:07 AM.

  5. #5
    Registered User
    Join Date
    10-14-2010
    Location
    WI
    MS-Off Ver
    Excel 2007
    Posts
    77

    Re: Using the Replace to remove Spaces in a Number

    Thanks for the explanation on that one. I guess its just a matter of opinion on that only allowing the 15 digits is lame. Ha.

  6. #6
    Registered User
    Join Date
    10-14-2010
    Location
    WI
    MS-Off Ver
    Excel 2007
    Posts
    77

    Re: Using the Replace to remove Spaces in a Number

    I have added positive reputation to both that looked to spend time to help my simple inquire. Thank you both.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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