ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   large binary numbers (https://www.excelbanter.com/excel-worksheet-functions/36559-large-binary-numbers.html)

Himu

large binary numbers
 
i want a column which will contain numbers from 0~65536. Then I want to
convert them into 16 bit binary numbers. How do I do this?

Barb Reinhardt

Will the DEC2BIN function get you what you want?

"Himu" wrote in message
...
i want a column which will contain numbers from 0~65536. Then I want to
convert them into 16 bit binary numbers. How do I do this?




Himu

no, for large numbers DEC2BIN functions dont work. Any other suggestions?


"Barb Reinhardt" wrote:

Will the DEC2BIN function get you what you want?

"Himu" wrote in message
...
i want a column which will contain numbers from 0~65536. Then I want to
convert them into 16 bit binary numbers. How do I do this?





MrShorty


A Google search for "algorithm for converting decimal to binary" yielded
several pages with descriptions of a couple of generic algorithms for
converting decimal numbers to binary numbers. I'm sure those
algorithms could be adapted to a spreadsheet or VBA procedure.


--
MrShorty
------------------------------------------------------------------------
MrShorty's Profile: http://www.excelforum.com/member.php...o&userid=22181
View this thread: http://www.excelforum.com/showthread...hreadid=389266


Jerry W. Lewis

Himu wrote:

no, for large numbers DEC2BIN functions dont work. Any other suggestions?


Sure it does, you just have to work a little harder.

=DEC2BIN(INT(n/256),8)&DEC2BIN(MOD(n,256),8)

However, 65536 = 2^16, so you need 17 bits to represent it, as in

=DEC2BIN(INT(n/256),9)&DEC2BIN(MOD(n,256),8)

Jerry



All times are GMT +1. The time now is 12:31 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com