+ Reply to Thread
Results 1 to 19 of 19

Save number as text in txt format wo changing the format

  1. #1
    Registered User
    Join Date
    08-22-2005
    Posts
    8

    Save number as text in txt format wo changing the format

    In order to export an excel table into another program I first need to save the excel file as .txt. The .txt file can then be imported by the other program.

    First I however need to make excel understand that the value should be a text and not a value. I therefore format the number as text (0000150235) by adding "0000150235". After saving the file as .txt the format changes from "0000150235" to """0000150235""". I do however need the format in the .txt file to be "0000150235". Can anyone tell me how I can save "0000150235" as .txt and get the value "0000150235" in the .txt file.

    Thank you
    Last edited by Tysken; 03-01-2007 at 08:35 AM.

  2. #2
    Registered User
    Join Date
    01-21-2004
    Location
    Liverpool
    MS-Off Ver
    2003
    Posts
    88
    simple way. Once you have saved it as text open it in notepad and use find and replace

    Find: ""
    Replace with: "

    Thats an easy way

    another way rather then using the "" to define it to excel that it is text is to format the cell.

    Select the range and right click goto format cells, and in the tab number selecte the text category.

    When the sheet is saved as a txt file then you will have the number with as
    "0000150235"
    regards
    Paul
    http://www.frontlineuk.com
    FrontLineUK

  3. #3
    Forum Expert oldchippy's Avatar
    Join Date
    02-14-2005
    Location
    Worcester, UK
    MS-Off Ver
    Excel 2007 (Home)
    Posts
    7,097
    You could also use the following formula

    =TEXT(A2,"0000000000"), then copy and paste special > Values
    oldchippy
    -------------


    Blessed are those who can give without remembering and take without forgetting

    If you are happy with the help you have received, please click the <--- STAR icon on the left - Thanks.

    Click here >>> Top Excel links for beginners to Experts

    Forum Rules >>>Please don't forget to read these

  4. #4
    Registered User
    Join Date
    08-22-2005
    Posts
    8
    Quote Originally Posted by pauluk
    simple way. Once you have saved it as text open it in notepad and use find and replace

    Find: ""
    Replace with: "

    Thats an easy way

    another way rather then using the "" to define it to excel that it is text is to format the cell.

    Select the range and right click goto format cells, and in the tab number selecte the text category.

    When the sheet is saved as a txt file then you will have the number with as
    "0000150235"
    Thank you.

    The "Find" and replace option is not applicable due size of the .txt file. It has more than 100.000 rows (using Excel 2007) and the Notepad dies on me when I try the "Find" and "Replace" option.

    I have tried the other option (formatting the cell) and it only gives me 0000150235 in the .txt file and not "0000150235".

    Sorry!

  5. #5
    Registered User
    Join Date
    01-21-2004
    Location
    Liverpool
    MS-Off Ver
    2003
    Posts
    88
    rather then saving a s an ms-dos txt file save it as a formatted text(Space Delimited)
    file extension .prn
    open that .prn in notepad and save as a txt file that should work and keep the "

  6. #6
    Registered User
    Join Date
    08-22-2005
    Posts
    8
    Quote Originally Posted by pauluk
    rather then saving a s an ms-dos txt file save it as a formatted text(Space Delimited)
    file extension .prn
    open that .prn in notepad and save as a txt file that should work and keep the "
    Thank you, it worked, but created a new problem. The tabs in the .txt file are replaced by space. This makes the data impossible to import into the other program.

  7. #7
    Forum Expert oldchippy's Avatar
    Join Date
    02-14-2005
    Location
    Worcester, UK
    MS-Off Ver
    Excel 2007 (Home)
    Posts
    7,097
    OK, try this, with """0000150235""" in A1, put this in B1

    =MID(A1,3,12), then copy and paste special as before

  8. #8
    Registered User
    Join Date
    08-22-2005
    Posts
    8
    Quote Originally Posted by oldchippy
    OK, try this, with """0000150235""" in A1, put this in B1

    =MID(A1,3,12), then copy and paste special as before
    Thank you, unfortunately I still get """0000150235""" in the .txt file.

    Cheers

  9. #9
    Forum Expert oldchippy's Avatar
    Join Date
    02-14-2005
    Location
    Worcester, UK
    MS-Off Ver
    Excel 2007 (Home)
    Posts
    7,097
    In that case modify the formula to

    =MID(A1,4,10) does that help?

  10. #10
    Registered User
    Join Date
    08-22-2005
    Posts
    8
    Quote Originally Posted by oldchippy
    In that case modify the formula to

    =MID(A1,4,10) does that help?
    Your formula works brilliant in excel. The probelm first occur after I save the file as .txt.

    Cheers

  11. #11
    Forum Expert oldchippy's Avatar
    Join Date
    02-14-2005
    Location
    Worcester, UK
    MS-Off Ver
    Excel 2007 (Home)
    Posts
    7,097
    Before you saved it, did you copy and paste values only? format cell as text?

  12. #12
    Registered User
    Join Date
    08-22-2005
    Posts
    8
    Quote Originally Posted by oldchippy
    Before you saved it, did you copy and paste values only? format cell as text?
    Yes, I did.

  13. #13
    Registered User
    Join Date
    01-21-2004
    Location
    Liverpool
    MS-Off Ver
    2003
    Posts
    88
    maybe this addin can help

    Yoiu might need to find an addin or something.

    Even when you have it as text and export it does not do it with "

    http://www.asap-utilities.com/asap-u...ilities=Export

    Its free ASAP i think

  14. #14
    Forum Contributor
    Join Date
    03-13-2005
    Posts
    6,195
    Quote Originally Posted by oldchippy
    Before you saved it, did you copy and paste values only? format cell as text?
    HI oldchippy,

    it's not the cell value at fault, the cell has "number" (or "0006767670" ) etc

    it's when you export a file some fields are set in quotes, ie, for a CSV file any comma in the data requires that field to be set in quotes (to preserve the comma)
    In this case the double-quotes is set in quotes, so that "000" becomes
    " "" 000 "" " where the blue pair are the 'set-in' quotes, and the red 'double-double-quotes' signify this is NOT a blue set-in quotes.

    The easy way is in Notepad to Replace all """ with " (ie, 3 double-quotes with one)

    hth
    ---
    Si fractum non sit, noli id reficere.

  15. #15
    Registered User
    Join Date
    08-22-2005
    Posts
    8
    Quote Originally Posted by Bryan Hessey
    The easy way is in Notepad to Replace all """ with " (ie, 3 double-quotes with one)

    hth---
    I have tried that, but the file is too big. The Notepad dies on me (over 40.000 rows)

  16. #16
    Forum Contributor
    Join Date
    03-13-2005
    Posts
    6,195
    Quote Originally Posted by Tysken
    I have tried that, but the file is too big. The Notepad dies on me (over 40.000 rows)
    was Wordpad any better?

    or, ignoring the 'seperated' in comma separated values, was Paul's addin any good?

    ---
    Last edited by Bryan Hessey; 03-01-2007 at 10:45 AM.

  17. #17
    Registered User
    Join Date
    08-22-2005
    Posts
    8
    Quote Originally Posted by Bryan Hessey
    was Wordpad any better?

    or, ignoring the 'seperated' in comma separated values, was Paul's addin any good?

    ---
    Unfortunately not. The Wordpad was as slow and I had to cancel it after 30 minutes. Paul's addin seems to be great, I cannot however get it to work properly in Excel 2007....

    Any more ideas?

    Cheers

  18. #18
    Registered User
    Join Date
    01-21-2004
    Location
    Liverpool
    MS-Off Ver
    2003
    Posts
    88
    Version 4.0 and upwards should work with excel 2007
    make sure you have the lastest version which i assume you have as it was released in november 2006.

    The only other suggestion i can make and it will be a long one is to the use the find and replace, but before running it split the txt file into mangable sections so that it does not freeze crash etc....

    It all depends how automated you want the process. from the sounds of this it is you who is doing the bulk of the work, so it may not be problem at present but in the long you will need a more robust solution.

    I know it is a headache but thats life....

  19. #19
    Registered User
    Join Date
    12-21-2005
    Posts
    10

    Search and Replace _""_ to _"_ On 1,000,000+ Lines

    Just tried my favourite NOTEPAD replacement (NOTETAB) and it searched and replaced "" with " on 1,000,000 lines in under 2 seconds on my notebook.

    Many versions from free to "pro" at
    http://www.notetab.com/

    Extremely useful Block Cut/Copy/Paste capability. One can take 'chunks' of text out of the middle of lines based on specified column starting position, ending position and number of rows. Thus I often use with Excel for modifying hyperlink formula's when making reference changes on thousands of rows...
    CRTL ~, copy forumulas, modify in Notetab, recopy and paste into new location.

    Has very handy scripting macros (albeit with a steep learning curve) when working with text.

+ 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