+ Reply to Thread
Results 1 to 3 of 3

Adding characters to raw data text strings

  1. #1
    Registered User
    Join Date
    05-31-2013
    Location
    Colorado, US
    MS-Off Ver
    Excel 2007
    Posts
    11

    Adding characters to raw data text strings

    Hi all, I was wondering if what I am tasked with is possible. I have thousands and thousands of codes, that I need to convert into a more usable format. I am wondering if there is a formula or way of converting these codes.

    For instance, each code needs to look like this: XXXX-XXXXX (4 digits, a dash, 5 digits).

    A few examples of how they are currently formatted:

    556-32840
    2568-00630
    3229- 1360


    And how they should look:

    556-32840 - Should be 0556-32840 (added a "0" to the first string)
    2568-00630 - Should be 2568-00630 (no change)
    3229- 1360 - Should be 3229-01360 (added a "0" to the second string)

    In ALL cases, any space should equal a "0".

    Anyone know if this is possible? Thanks so much !

    EDIT: ALSO, in all cases, the spaces will appear at either the front of the first or second string.

  2. #2
    Valued Forum Contributor
    Join Date
    09-10-2012
    Location
    Los Angeles, CA
    MS-Off Ver
    Excel 2010
    Posts
    929

    Re: Adding characters to raw data text strings

    If your first value is in A1, then put this formula in B1...

    =TEXT(VALUE(LEFT(A1,SEARCH("-",A1)-1)),"0000")&"-"&TEXT(VALUE(RIGHT(A1,LEN(A1)-SEARCH("-",A1))),"00000")

    Copy this formula to the other cells...

  3. #3
    Registered User
    Join Date
    05-31-2013
    Location
    Colorado, US
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Adding characters to raw data text strings

    Excellent !! That worked. Thank you so much djapigo. Now, I'm going to have to go through that formula and try and figure out how you did it.

    Thanks again !!

+ 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