# Thread: Hex to Binary using a divide and conquer approach for the first and second digit

1. ## Hex to Binary using a divide and conquer approach for the first and second digit

I am trying to find a formula that convert Hex to Binary. I have already found one but now I am required to use a divide and conquer approach for the first and second digit.
example:
 Input Hex B7 B= 1st digit 7= 2nd digit Binary 10110111
someone suggest me to consider Right and Left functions to extract the digits from the input and & for concatenating strings any formula suggestions?

Thanks  Reply With Quote

2. Seems like overkill considering HEX2BIN does this on it's own,

Code:
`=HEX2BIN(A2,8)`
but if you insist on using LEFT and RIGHT and "&", and a maximum of two characters, try:

Code:
`=CHOOSE(LEN(A2),HEX2BIN(A2,4),HEX2BIN(LEFT(A2,1),4)&HEX2BIN(RIGHT(A2,1),4))`
Cheers,  Reply With Quote

3. thank you so much... that's the formula i was trying to get... it works..  Reply With Quote  Reply With Quote

5. Again, you can do this with BIN2HEX like this:

Code:
`=BIN2HEX(A2)`
or using LEFT & RIGHT like this:

Code:
`=IF(LEN(A2)=8,IF(BIN2HEX(LEFT(A2,4),1)="0",BIN2HEX(RIGHT(A2,4),1),BIN2HEX(LEFT(A2,4),1)&BIN2HEX(RIGHT(A2,4),1)),"Requires 8 binary digits")`
Cheers,  Reply With Quote

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•