+ Reply to Thread
Results 1 to 2 of 2

Thread: Number Formatting

  1. #1
    Registered User
    Join Date
    07-15-2011
    Location
    Oklahoma
    MS-Off Ver
    Excel 2003
    Posts
    1

    Number Formatting

    I tried to look this up but my brain doesn't want to function today due to lack of sleep and I'm in a bit of a time crunch at work...

    I have a range of unformatted 12 digit numbers (they actually contain a few letters also if that matters, example: TS310A124400) that I would like hyphens inserted into like so:

    TS-31-0A-12-44-00

    Thanks in advance.

  2. #2
    Forum Guru NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    32,636

    Re: Number Formatting

    One quick way:

    =LEFT(A1,2)&"-"&MID(A1,3,2)&"-"&MID(A1,5,2)&"-"&MID(A1,7,2)&"-"&MID(A1,9,2)&"-"&RIGHT(A1,2)

    or

    =REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(A1,3,0,"-"),6,0,"-"),9,0,"-"),12,0,"-"),15,0,"-")
    Last edited by NBVC; 07-15-2011 at 02:09 PM.
    Microsoft MVP - Excel

    Where there is a will there are many ways. Pick One!


    Please read the Forum Rules

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

    Preferred Charities: Lupus Canada and Sick Kids Foundation.
    Feel Free to Donate if you want to, for the assistance you received today.

+ Reply to Thread

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.2.0