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!