Formula to add a ":" after every 2 characters in a cell?

suncandle

New Member
Joined
May 12, 2009
Messages
4
Hi Everyone,
I have searched online and in help but can't seem to find the best solution...

I have values like 00904BB303D6 that need to become: 00:90:4B:B3:03:D6 (the value is always 12 digits, and the : needs to appear every two digits.) Is there a formula that can easily do this for me? Your suggestions are greatly appreciated!

Thanks in advance!!!!
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
Hello and welcome to MrExcel.

Try

=LEFT(A1,2)&":"&MID(A1,3,2)&":"&MID(A1,5,2)&":"&MID(A1,7,2)&":"&MID(A1,9,2)&":"&RIGHT(A1,2)
 
Upvote 0
=LEFT(A1,2)&":"&MID(A1,3,2)&":"&MID(A1,5,2)&":"&MID(A1,7,2)&":"&MID(A1,9,2)&":"&RIGHT(A1,2)

Might be a better way than this but this should work
 
Upvote 0
Wow, those responses were super quick! Thank you so much everyone, and thanks for the welcome VoG.

I will give these a try and let you know how they work!
 
Upvote 0
That worked great - thank you again.

My next question - is there any way to have that formula work for the cell that the value is in? If there is an easy solution, I'd appreciate your sharing it.

:)
 
Upvote 0
Try this: press ALT + F11 to open the Visual Basic Editor then Insert > Module then paste into the white space on the right

Code:
Sub test()
Dim c As Range
For Each c In Selection
    c.Value = Left(c, 2) & ":" & Mid(c, 3, 2) & ":" & Mid(c, 5, 2) & ":" & Mid(c, 7, 2) & ":" & Mid(c, 9, 2) & ":" & Right(c, 2)
Next c
End Sub

Press ALT + Q. Select the range of values to convert, Tools > Macro > Macros, click on test then click the Run button.

:eek: This is irreversible - there is no Undo. :eek:
 
Upvote 0
If you use the German excel version, use to add ":" to your mac adress field:
=LINKS(A1;2)&":"&TEIL(A1;3;2)&":"&TEIL(A1;5;2)&":"&TEIL(A1;7;2)&":"&TEIL(A1;9;2)&":"&RECHTS(A1;2)

Thanks to the auther. Helped me after 9 years of the original post.
 
Upvote 0

Forum statistics

Threads
1,213,552
Messages
6,114,278
Members
448,560
Latest member
Torchwood72

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top