How do I format cells for MAC Addresses

JayHertz

New Member
Joined
Dec 2, 2004
Messages
1
Quick question...I am trying to build an excel spreadsheet of MAC addresses from networking cards to cross reference them against user ID's...the MAC address format in the Hexadecimal, with characters ranging from 0-9 A-F. The MAC Address is in the format of xxxx.xxxx.xxxx.xxxx 16 characters and 3 decimal points. Can you help? Or should I just use the text format and enter the demical points?
Thanks
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
How do I format cells for MAC addresses?

Hello, everyone! I have the same question that JayHertz asked two years ago: How to format MAC addresses in Excel? I have searched Excel Help, the knowledge base, and the Internet without success so far.

My shop is trying to format MAC addresses from a text dump imported as a .csv file into Excel. The MAC addresses come through as hex numbers with no format, e.g. 0006F8E4857B, and my engineers want to convert that to a correctly formatted MAC address, e.g. 00-06-F8-E4-85-7B, without having to manually add the hyphens to each entry.

-- It seems apparent that there is no way for the user to make Excel "hexidecimal-aware". (Hello? Microsoft???) Using HEX2DEC did not work for hex numbers with ABCDEF digits. It did work for numbers written only in decimal numeric characters. Adding the analysis add-in made no difference.

-- Treating hex numbers as text would work fine in this case, except that there seems to be no way to do a custom format on a text value. I tried using 00-00-00-00-00-00, ##-##-##-##-##-##, and ??-??-??-??-??-?? as custom formats, and none of them work if there are alpha characters in the hex digits.

So: What am I doing wrong? Is there something else I can try?
Thanks very much for your help, and apologies for the length of this post.
 
Upvote 0
Re: How do I format cells for MAC Addresses - SOLVED!

I have spent the last several days also trying to find how to do this. Finally my brilliant colleague worked out a convoluted formula, but hey, it works! In my case, my company is manufacturing Ethernet circuit boards for a product that we make, and we have to create our own, consecutive, MAC addresses. There should be enough information in here to help anyone that needs to deal with MAC addresses in Excel. A friend of mine suggested writing a macro to do this with the cells formatted to text, which may be easier, but I'm not familiar with writing macros.

=CONCATENATE(B2,(MID(C2,1,2)),$D$1,(MID(C2,3,2)),$D$1,(MID(C2,5,2)))

Here's how we ended up with that (and how to convert from decimal to hex since that's where I started):

Decimal to hex:
Row 1 is my header row, Column A showed my serial numbers (1 through 500), Column B held the six static characters which happened to be 00-19-2E- and I added the end hyphen, Column C holds the formula =DEC2HEX(A1,6) which tells Excel to convert the decimal formula in cell A1 to hexadecimal, and to show 6 characters (it'll do up to 10). After you create the hexidecimal numbers, select the entire column and format the cell to Text, or the rest won't work.

Before doing that, unless you're using Excel 2007, you need to install the Analysis add-in from the Excel or Office disk. Then, go to Tools, open up Add-ins, find the Analysis listing and check the box. Restart your computer, and now Excel should recognize a newly-entered formula - for some reason it didn't change the formula I put in before installing the Analysis add-in.

Hex to proper format:
So, now I had consecutive hex values in Column C, but they looked like this: 000001, 000002, etc.

Column D holds the convoluted formula from above. =CONCATENATE(B2( tells Excel to pull the information from cell B2 and put it in front of whatever comes after the last open parenthesis.

MID(C2,1,2) tells Excel to look at cell C2 (my hex values), start with the first character position and pull two characters, so the result if that formula was by itself would be 00. MID(C2,3,2) pulls the third and fourth character, and MID(C2,5,2) of course pulls the fifth and sixth.

In cell D1 we put an apostrophe followed by a hyphen. Between each set of MID commands, $D$1 forces Excel to pull the info from cell D1 instead of going to D2, D3, etc. as the formula is dragged down the column.

Drag the bottom right corner of the cell with the long formula down the page and you'll see a lovely list of perfectly formatted MAC addresses.

If you'd like a copy of the spreadsheet, email me at tikisdream@gmail.com.

If you know of another good Excel forum, let me know, I want to get this info out there and save more headaches!
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,286
Messages
6,177,696
Members
452,796
Latest member
adix03

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