Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
 
Posts: n/a
Default Hexadecimal to binary

Can someone point me to an online resource or explain how I can convert a
hexadecimal number into a binary number whilst also retaining the leading
zeros.
Some of the hex numbers are too large for the HEX2BIN function. I need the
leading zeros in the result so I can look at specific chunks bit values
using MID().

Tia
  #2   Report Post  
Posted to microsoft.public.excel.misc
Gary''s Student
 
Posts: n/a
Default Hexadecimal to binary

Use chunking to convert large hex values one hexal at a time:

Let's say we have 1abc in A1. HEX2BIN() won't work. In A2 thru A5 put:

=HEX2BIN(LEFT(A1))
=HEX2BIN(MID(A1,2,1))
=HEX2BIN(MID(A1,3,1))
=HEX2BIN(RIGHT(A1))
and you will see:

1
1010
1011
1100

in A6 put:
=A2&A3&A4&A5
to see:
1101010111100
all 13 bits
You can now concatenate enough leading zeros to make any fixed length.


--
Gary''s Student


" wrote:

Can someone point me to an online resource or explain how I can convert a
hexadecimal number into a binary number whilst also retaining the leading
zeros.
Some of the hex numbers are too large for the HEX2BIN function. I need the
leading zeros in the result so I can look at specific chunks bit values
using MID().

Tia

  #3   Report Post  
Posted to microsoft.public.excel.misc
 
Posts: n/a
Default Hexadecimal to binary

Many thanks.
  #4   Report Post  
Posted to microsoft.public.excel.misc
 
Posts: n/a
Default Hexadecimal to binary

Is there a way to get the result of the formula to display to a specified
format so that in your example the first HEX2BIN would return 0001 as the
answer? Custom formats don't seem to work on the results of a formula.
  #5   Report Post  
Posted to microsoft.public.excel.misc
 
Posts: n/a
Default Hexadecimal to binary

Found it.

=HEX2BIN(LEFT(A3,2),8) & HEX2BIN(RIGHT(A3,2),8)


  #6   Report Post  
Posted to microsoft.public.excel.misc
Gary''s Student
 
Posts: n/a
Default Hexadecimal to binary

A very good solution. Once I realized that HEX2BIN was really just playing
with strings, solutions became a lot easier to find.


Have a pleasant weekend
--
Gary's Student


" wrote:

Found it.

=HEX2BIN(LEFT(A3,2),8) & HEX2BIN(RIGHT(A3,2),8)

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I change hexadecimal number to binary in excel Aimran Excel Worksheet Functions 3 November 9th 05 10:24 PM
Is there a way to count higher than 511 in binary in excel? havocdragon Excel Worksheet Functions 1 October 15th 05 05:14 AM
Solver returns non binary answer in binary constrained cells Navy Student Excel Worksheet Functions 6 September 1st 05 03:11 PM
binary bit word Don Excel Worksheet Functions 2 August 20th 05 02:54 PM
Binary Numbers longer than 10 characters Andibevan Excel Worksheet Functions 2 April 6th 05 10:08 PM


All times are GMT +1. The time now is 10:05 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"