Need the last 16 digits of a binary number so that I can convert it to decimal

Silverbackman

New Member
Joined
Jan 16, 2015
Messages
2
Hi all. First time posting.
If this was answered somewhere else, please point me in that direction.

I have to convert decimal numbers to binary, then take the last 16 digits of that binary number and convert them back to decimal.
For example
1701527 is
110011111011010010111

<tbody>
</tbody>

I need the last 16 digits
111011010010111

Which I then convert back to digital and get
63127

What i'd like to do is put the first number into one cell and then in another cell see the final result

Is this possible?

I have tried =RIGHT and =RIGHT+0, but the first gives me a text version and the second when I use it with BIN2DEC comes back with #NUM

Jeff.
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
So BIN2DEC and DEC2BIN only work with 8 bit binary numbers. I think that's -512(-511) to +511(+512). Since your decimal number is quite larger than this, you'll need to string together the binary digits.
to get the last 16 binary digits of a number use this formula:
=RIGHT(DEC2BIN((MOD(A1,4294967296)/16777216),8) & DEC2BIN(MOD(A1,16777216)/65536,8) & DEC2BIN(MOD(A1,65536)/256,8) & DEC2BIN(MOD(A1,256),8),16)
The above formula works for a 32 bit binary number (approx 2.15 billion)
and then the following formula should return the number corresponding to the 16 bit binary number returned from the equation above
=BIN2DEC(RIGHT(B1,8))+256*BIN2DEC(LEFT(B1,8))
Hope that helps,
Matt
 
Upvote 0

Forum statistics

Threads
1,216,084
Messages
6,128,724
Members
449,465
Latest member
TAKLAM

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top