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.
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.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks