# Separating Binary digits in Excel

si_gone 14:37 20 Sep 2007
Locked

In Excel, I have used the "HEX2BIN" function to convert a hexadecimal digit to a four bit binary word. On the next row, I want to separate each of the four binary bits into it's own cell. Is this a simple mathematical function? Or is there a function or VB routine that will achieve this? Or am I just being a bit thick?

VoG II 15:15 20 Sep 2007

With AF in A1 then

=HEX2BIN(A1)

yields 10101111

Copy the binary value then Edit > Paste Special and tick Values to paste only the values into another cell. With that cell selected Data > Text to Columns, specify Fixed width and add a break after each digit. You should end up with

1 0 1 0 1 1 1 1

VoG II 15:19 20 Sep 2007

Without the need for paste special, with a 4-digit binary in B2 then in C2 to F2

=MID(B2,1,1)

=MID(B2,2,1)

=MID(B2,3,1)

=MID(B2,4,1)

si_gone 15:59 20 Sep 2007

Excellent...and so simple, too! I was just being thick, wasn't I! Thanks very much!

si_gone 08:18 05 Oct 2007

Now I need to do the opposite. I have a row of cells, each with a 1 or 0 in it. I need to take four of the cells and copy the contents into one merged cell below, e.g 1, 1, 0, 1 in four cells into 1101 in one cell. Is that possible?

VoG II 11:19 05 Oct 2007

Try something like

=CONCATENATE(A1,B1,C1,D1)

si_gone 14:54 08 Oct 2007

Excellent, thanks! It worked! It's just me being a biff and not knowing what CONCATENATE means!

This thread is now locked and can not be replied to.

Elsewhere on IDG sites

Honor 9 Lite review

How Sam Falconer transforms science and geology into digestible, elegant illustrations

HomePod review

Les meilleures séries Netflix (2018)