Converting Decimal to Binary & vice versa

Zhuge-Liang

New Member
Joined
May 11, 2007
Messages
43
Greetings,

I was hoping someone would be kind enough to help me out with a small dilemma.

Is there a formala or macro which would enable me to convert an 8-bit binary number to decimal and vice versa.

Example 1. 11111111 =256
Example 2. 00000001 =1
Example 3. 01010101 =85


Basically i want to be able to input a number in to a cell and then select either of two buttons. Button 1 would convert to binary, whilst button 2 would convert to decimal.

It is only necessary to have up to 8 bits of data, although anything above that would be a great asset too.

Just some help with binary. I am placing the headers below.


128 64 32 16 8 4 2 1


Thanks for your help.
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
Assuming you have the Analysis Toolpak installed, you can use the function Dec2Bin and Bin2Dec:

in B1 if A1 contains 256:

=Dec2Bin(A1)

Then in C1:

=Bin2Dec(B1)
 
Upvote 0

Forum statistics

Threads
1,215,409
Messages
6,124,743
Members
449,186
Latest member
HBryant

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