+ Reply to Thread
Results 1 to 14 of 14

Excel 2007 : "text" with numbers

  1. #1
    Registered User
    Join Date
    04-25-2012
    Location
    blaine, wa
    MS-Off Ver
    Excel 2007
    Posts
    9

    "text" with numbers

    I am trying to display/store a zip code including a leading zero. I change the format options to "TEXT", set up each find/replace as "TEXT", but the zip stubbornly refuses to add that zero. What I am doing wrong?

  2. #2
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,327

    Re: "text" with numbers

    Excel is seeing the zip as a number so it drops the proceeding zero...

    Enter the zip as >> '01212
    HTH
    Regards, Jeff

  3. #3
    Registered User
    Join Date
    04-25-2012
    Location
    blaine, wa
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: "text" with numbers

    This changes only the target zip. How do I change the 300+ in the column?

  4. #4
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,327

    Re: "text" with numbers

    Select the column of 300+, go to the VBE (Alt + F11), insert new module, paste this macro on the right side of the screen and run.

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    04-25-2012
    Location
    blaine, wa
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: "text" with numbers

    What if zip is "11111" ? Then the zero is NOT wanted.

  6. #6
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,327

    Re: "text" with numbers

    This macro does not add a zero. Did you run it?

  7. #7
    Registered User
    Join Date
    04-25-2012
    Location
    blaine, wa
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: "text" with numbers

    So, the apostrophe means "keep what ever there is, AS IS", correct? Why in heck doesn't "TEXT" do the same ???

  8. #8
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,327

    Re: "text" with numbers

    Not really sure why, but the apostrophe means to look at the entered value as text even though it is a number.

    Also, usually when something is left aligned it is text, but when right aligned, a number (of course this is before somebody manipulated the cell).

    Try this, type 1111 in a cell. After you hit enter it should by default right align since it is a number. Now go back into the cell with the 1111 and before 1111 enter the apostrophe. Now after you hit enter Excel treats it as text so it should left align

  9. #9
    Registered User
    Join Date
    04-25-2012
    Location
    blaine, wa
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: "text" with numbers

    Our zip code data field is LEFT-aligned in our file, as it ought to be. So why isn't it treated as text? 01234 should remain 01234 when excel-formatted as "text"!

  10. #10
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,327

    Re: "text" with numbers

    As far as I understand, it is treated as text until you touch that cell. I have data in which I also extract from another system with value such as 0004, 0104, 0160, etc.

    As soon as I enter one of these cells and then exit, Excel now decides that cells is a number so it drops the leading zero. I end up with 4, 104, 160.

    Not sure I can give you a better explanation than this. Maybe one of the more experienced Excellers can give a better answer.

  11. #11
    Registered User
    Join Date
    04-25-2012
    Location
    blaine, wa
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: "text" with numbers

    OK. That being the case, why doesn't excel allow a no-questions-asked REformat, back to text, and then treat it as such? Seems a major flaw in excel.

  12. #12
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,327

    Re: "text" with numbers

    Could be, but at this time I don't have a dog in that hunt

  13. #13
    Registered User
    Join Date
    04-25-2012
    Location
    blaine, wa
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: "text" with numbers

    Thanks for helping out, Jeff


  14. #14
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,327

    Re: "text" with numbers

    You're welcome

+ 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