Results 1 to 4 of 4

Keep leading zeros?

Threaded View

  1. #1
    Registered User
    Join Date
    04-11-2011
    Location
    Dublin, Ireland
    MS-Off Ver
    Excel 2007
    Posts
    4

    Keep leading zeros?

    Hi!
    I have been struggling with this for a few hours and have exhausted every avenue i can think of.
    I have a text file with several hundred strings of text. Each string is of varying length. I wish to extract the last four numbers from each string. The numbers are separated by spaces and vary between 0 and 9999, so i cannot do a simple RIGHT function.
    What i have tried is the following;
    I found quite a nice macro that reverses the text in a string. I use this on each line, thereby putting the numbers i want at the start of the string, but backwards. I then use text to columns, using space as the delimiter. I then use the same reverse function as above on each of the fields i require.
    THE PROBLEM!
    If any of the numbers end in 0, after i reverse the string and then delimit it the zero is lost because it is treated as a leading zero. I have tried formatting the fields both before and after the delimitation, either as text fields or by adding in zeros with a custom format and nothing works.
    Does anyone know of a way to keep leading zeros after a string is delimited? Any other suggestions as to how to solve my problem are more than welcome too!
    Thanks,
    Cj
    Last edited by cjki; 04-11-2011 at 02:38 PM. Reason: Solved.

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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