+ Reply to Thread
Results 1 to 22 of 22

Strange unseen characters in front of numbers

  1. #1
    Registered User
    Join Date
    07-10-2015
    Location
    israel
    MS-Off Ver
    2007
    Posts
    4

    Strange unseen characters in front of numbers

    Hi,

    I received an excel file that I need to upload to sql server. However, from research I have done after having problems importing the memberid column into a number field in sql I found out that there are strange characters that can't be seen in front of some numbers in excel. If for example I filter the column and search for memberid numbers that start with 00 it only returns one number. That is becuase other numbers have that strange character in front.
    How can I get rid of these characters?
    The character is seen here -http://postimg.org/image/dybytecgx/
    Again, i only see that character in a tool that comes with sql and not in the excel itself.
    I tried to upload a sample excel file. Example of problem id 066216666‏

    How do i solve this issue?

    Thanks
    Attached Files Attached Files

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,052

    Re: Strange unseen characters in front of numbers

    Hi, welcome to the forum

    You have over 3000 rows of data there, can you point me to some that have that problem? (Im not going to search them all)
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Strange unseen characters in front of numbers

    Not seeing it in the uploaded file.

    However, the values in column A in that file are stored as numbers, therefore you will not find a value of 066216666 as the zero is not counted.

    If you really are seeing a character before your number, Copy and paste it into Find/Replace window, replacing it with nothing. That should remove it from all your cells.‏
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  4. #4
    Registered User
    Join Date
    01-11-2011
    Location
    Gravesend, England
    MS-Off Ver
    Excel 2003
    Posts
    22

    Re: Strange unseen characters in front of numbers

    ChemistB seems to have the right of it judging by your data. if you need it in that format, just use the following formula:

    =IF(LEN(A2)=7,"00",if(Len(a2)=8,"0",""))&A2

    automatically inserts 0s to make length up to 9 characters and converts to a string

    (Tip: For future checks, try the CLEAN() formula. Deletes unprintable characters.)

  5. #5
    Registered User
    Join Date
    07-10-2015
    Location
    israel
    MS-Off Ver
    2007
    Posts
    4

    Re: Strange unseen characters in front of numbers

    excel.jpg

    Thanks all for the replies. In excel you can't see the strange character. Only in sql server.
    When I paste that character in any other places it comes up as blank...you don't see anything so I can't even replace it.

  6. #6
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Strange unseen characters in front of numbers

    It looks like it's designating those numbers as text. It is not seen on the values that do not start with 0 (i.e. actual numbers).

    Is the issue with with sql or with Excel? I think if you use the formula that Hillsy suggested, it will take care of your Excel issues, everything will be text and everything will be 9 characters long.

  7. #7
    Registered User
    Join Date
    07-10-2015
    Location
    israel
    MS-Off Ver
    2007
    Posts
    4

    Re: Strange unseen characters in front of numbers

    I am having problems importing them to sql as those numbers with the strange characters is imported as NULL. I think the problem stems from excel.
    I will try the formula suggested.

  8. #8
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Strange unseen characters in front of numbers

    Okay, if you don't want them to be Null, then we need to do the opposite.
    You need to convert all your Excel values to numbers before you import them into sql

    One way, In a blank cell enter 1. Then Copy it
    Select your range of numbers and Paste Special> Multiply
    That will convert all the text to numbers

    Did that work?

  9. #9
    Registered User
    Join Date
    07-10-2015
    Location
    israel
    MS-Off Ver
    2007
    Posts
    4

    Re: Strange unseen characters in front of numbers

    Tried paste special multiply - the values are all 0.

  10. #10
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 V 2507
    Posts
    13,809

    Re: Strange unseen characters in front of numbers

    Won't let me post formula. What's up?
    Last edited by FlameRetired; 07-11-2015 at 12:25 PM.
    Dave

  11. #11
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Strange unseen characters in front of numbers

    This might also be of interest. It takes the value in column A and changes it to text padded to 9 characters if necessary by adding leading 0s.

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    <---------If you like someone's answer, click the star to the left of one of their posts to give them a reputation point for that answer.
    Ron W

  12. #12
    Valued Forum Contributor rollis13's Avatar
    Join Date
    01-26-2012
    Location
    Cordenons
    MS-Off Ver
    Excel 2016 32bit - Win 11
    Posts
    935

    Re: Strange unseen characters in front of numbers

    All I noticed is that some cells have a leading and an ending character hex 00FE that should not be there.
    No idea how to clean your cells with an Excel formula or with VBA but as a work-around you could:
    1) copy the column to a sheet in a new file
    2) save the new file as .CSV
    3) open this new .CSV file with Notepad
    4) from menu substitute all the " ? " characters with " leave empty " to get rid of the extra characters that now show as a question mark
    5) save the file
    6) open the new .CSV with Excel
    7) copy the cleaned column back to the origin (copy of )
    Last edited by rollis13; 07-11-2015 at 05:30 PM.

  13. #13
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 V 2507
    Posts
    13,809

    Re: Strange unseen characters in front of numbers

    REPLACE works too, but Forum won't take my post with the formula.

  14. #14
    Valued Forum Contributor rollis13's Avatar
    Join Date
    01-26-2012
    Location
    Cordenons
    MS-Off Ver
    Excel 2016 32bit - Win 11
    Posts
    935

    Re: Strange unseen characters in front of numbers

    @FlameRetired, well, maybe, you could attach a screenshot of your formula.

  15. #15
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 V 2507
    Posts
    13,809

    Re: Strange unseen characters in front of numbers

    I've never tried that before.
    Attached Images Attached Images

  16. #16
    Valued Forum Contributor rollis13's Avatar
    Join Date
    01-26-2012
    Location
    Cordenons
    MS-Off Ver
    Excel 2016 32bit - Win 11
    Posts
    935

    Re: Strange unseen characters in front of numbers

    @FlameRetired, next time reduce the dimension of the Excel window, center the cells you need to show and then press Alt+Stamp (instead of only Stamp) to copy.

    It seems to me that your formula, as many other attempts I have done, when you copy the column and use Paste Special/Value to get rid of the formula and have only the resulting numbers, nothing changes.
    Last edited by rollis13; 07-12-2015 at 11:27 AM.

  17. #17
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 V 2507
    Posts
    13,809

    Re: Strange unseen characters in front of numbers

    Quote Originally Posted by rollis13 View Post
    @FlameRetired, next time reduce the dimension of the Excel window, center the cells you need to show and then press Alt+Stamp (instead of only Stamp) to copy.

    It seems to me that your formula, as many other attempts I have done, when you copy the column and use Paste Special/Value to get rid of the formula and have only the resulting numbers, nothing changes.
    Thanks for the Alt+Stamp tip. I always wondered how posters did that! LOL

    The "center the cells" part 'threw' me. My intent was to show the formula in the formula bar. I should have been clearer about that. My apologies.

    I did a copy / paste values of the cells containing my formula and the characters were still removed as intended.

    What am I missing?

  18. #18
    Valued Forum Contributor rollis13's Avatar
    Join Date
    01-26-2012
    Location
    Cordenons
    MS-Off Ver
    Excel 2016 32bit - Win 11
    Posts
    935

    Re: Strange unseen characters in front of numbers

    The "center the cells" part 'threw' me.
    It's ok, when you reduce the size of the window it becomes hard to match formula bar and cells
    What am I missing?
    Tested your formula again, my mistake (did a copy/paste of the wrong cells). But, your formula has to be used only on the offending cells, so sorting is needed to find them all.
    Last edited by rollis13; 07-12-2015 at 06:15 PM.

  19. #19
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Strange unseen characters in front of numbers

    It looks to me that the "special characters" only occur when you import numbers to sql as text. Therefore, to remove the characters, he needs to convert everything to numbers in Excel, not the other way around. If he wants it visually to look like 9 digits with leading zeroes, then he can do a custom format of 000000000.

  20. #20
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Strange unseen characters in front of numbers

    The question then is, will the number format be imported as shown in Excel. It has been a very long time since I imported from Excel into Sql but at that time the formatting was stripped when imported. Of course in the time that has passed, a lot has probably changed in that are.

  21. #21
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Strange unseen characters in front of numbers

    I don't believe that the formatting will be exported. It comes down to which is more important to the user, the ability to use these values as numbers or the way they look.

  22. #22
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Strange unseen characters in front of numbers

    @ChemistB
    I agree, with your question about what is important.

    If I remember correctly, SQL is able to format output as required as long as the data is consistent (all numbers in this case) including padding the output to a number of characters.

+ 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. Adding Same Characters In Front Of and Behind a Column of Numbers
    By jrstites in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 09-08-2014, 11:49 AM
  2. Replies: 3
    Last Post: 03-19-2014, 08:02 AM
  3. [SOLVED] Delete characters and add * in front and last characters in ACCESS QUERY
    By LALTIZER in forum Access Tables & Databases
    Replies: 9
    Last Post: 02-01-2013, 02:06 PM
  4. [SOLVED] Delete Unseen Characters
    By ajocius in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-28-2012, 03:15 AM
  5. Strange Characters in Cell
    By Jack Gillis in forum Excel General
    Replies: 0
    Last Post: 07-06-2006, 04:25 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