How do I create a custom cell format in numbers that sections hex numbers?

I need to create a custom cell format that's 3x 2-place hexadecimal numbers separated by some character such as a period or a colon like in MAC or IPv6 addresses; only much shorter eg;


  • 32-9a-e9

or

  • 32:9a:e9

or

  • 32.9a.e9


I'd like to enter the three parts of the number as a six digit string and have Numbers break it apart for me but I can't figure it out how to do it? The placeholders are only a handful and though Numbers handles hex fine, the placeholders specifically focus on decimal numbers. It would be much easier with regex but there's no support for it (that I know of.)


Is it possible?


Thanks!

Posted on Aug 12, 2025 2:30 AM

Reply
Question marked as Top-ranking reply

Posted on Aug 12, 2025 8:08 AM

I don't think it can be done with a cell format in the cell you are typing into. You can use a formula in an adjacent cell to put the delimiter between the sets of characters. The result will be text, not a number, so no doing math on it.


If you type your "numbers" into A2, you can use this formula in B2:

=TEXTJOIN(":",0,REGEX.EXTRACT(A2,"\w\w",0))


If your text does not have an even number of digits, the rightmost single digit will get dropped (because it does not match "/w/w"). Characters other than a-z, A-Z, 0-9 will also cause problems.


You may want to set column A (or whichever one you type into) as text format so what you type doesn't change after you hit enter (dropping leading zeros, for example).

3 replies
Question marked as Top-ranking reply

Aug 12, 2025 8:08 AM in response to senseivita

I don't think it can be done with a cell format in the cell you are typing into. You can use a formula in an adjacent cell to put the delimiter between the sets of characters. The result will be text, not a number, so no doing math on it.


If you type your "numbers" into A2, you can use this formula in B2:

=TEXTJOIN(":",0,REGEX.EXTRACT(A2,"\w\w",0))


If your text does not have an even number of digits, the rightmost single digit will get dropped (because it does not match "/w/w"). Characters other than a-z, A-Z, 0-9 will also cause problems.


You may want to set column A (or whichever one you type into) as text format so what you type doesn't change after you hit enter (dropping leading zeros, for example).

Aug 12, 2025 11:15 AM in response to senseivita

> It would be much easier with regex but there's no support for it (that I know of.)


There is regular expression support, via the REGEX.EXTRACT() function.


Given a value "aabbcc" in cell B2, this function will return the format you request:


=REGEX.EXTRACT(B2,"(..).*",1,1)&":"&REGEX.EXTRACT(B2,"..(..).*",1,1)&":"&REGEX.EXTRACT(B2,".{4}(..)",1,1)


=> "aa:bb:cc"


If you're familiar with regular expressions you know there are a myriad of ways of parsing the text, so my approach may not be the best, but it should show you the idea.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

How do I create a custom cell format in numbers that sections hex numbers?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.