#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 75
Default Bin2Dec

I have searched the community website for VBA codes to convert binary code to
decimal but did not find any; although there are VBA codes for converting
decimal to binary codes.

Can anybody advise, where I can get hold of VBA codes for converting binary
code to decimal? I don't have the Analysis Tookpak.

Thank you.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 222
Default Bin2Dec

The DEC2BIN function is the one you want, and you are correct that it is part
of the Analysis Toolpack.

Instructions on isntalling this free expansion pack are he
http://office.microsoft.com/en-us/ex...277241033.aspx

--
"Actually, I *am* a rocket scientist." -- JB

Your feedback is appreciated, click YES if this post helped you.


"Francis Ang" wrote:

I have searched the community website for VBA codes to convert binary code to
decimal but did not find any; although there are VBA codes for converting
decimal to binary codes.

Can anybody advise, where I can get hold of VBA codes for converting binary
code to decimal? I don't have the Analysis Tookpak.

Thank you.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Bin2Dec

I'm just curious on how you would use this. Would you have a cell that has a
binary number in 1's and 0's and you want this converted to a decimal value?

Jerry

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 75
Default Bin2Dec

Hi Jerry,

I have a file that contains some binary code which I need to convert to
decimals. I am also looking for codes that convert HEX2DEC. I know Excel has
these functions, but I don't have the Analysis Toolpack.

"JerryH" wrote:

I'm just curious on how you would use this. Would you have a cell that has a
binary number in 1's and 0's and you want this converted to a decimal value?

Jerry

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Bin2Dec

Here is a VB function I've posted in the past that will handle up to a
96-bit binary number (which I'm guessing is way more than you will need)...

Function Bin2Dec(BinaryString As String) As Variant
Dim X As Integer
Const TwoToThe48 As Variant = 281474976710656#
For X = 0 To Len(BinaryString) - 1
If X 48 Then
Bin2Dec = CDec(Bin2Dec) + Val(Mid(BinaryString, _
Len(BinaryString) - X, 1)) * _
TwoToThe48 * CDec(2 ^ (X - 48))
Else
Bin2Dec = CDec(Bin2Dec) + Val(Mid(BinaryString, _
Len(BinaryString) - X, 1)) * CDec(2 ^ X)
End If
Next
End Function

--
Rick (MVP - Excel)


"Francis Ang" wrote in message
...
Hi Jerry,

I have a file that contains some binary code which I need to convert to
decimals. I am also looking for codes that convert HEX2DEC. I know Excel
has
these functions, but I don't have the Analysis Toolpack.

"JerryH" wrote:

I'm just curious on how you would use this. Would you have a cell that
has a
binary number in 1's and 0's and you want this converted to a decimal
value?

Jerry


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
BIN2DEC conversion for large binary numbers ahmedmidany Excel Worksheet Functions 21 April 4th 23 11:34 AM
BIN2DEC bits 0-5 then 6-15 Jim Excel Worksheet Functions 5 May 28th 06 06:24 PM


All times are GMT +1. The time now is 01:17 PM.

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"