Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Nebulae
 
Posts: n/a
Default How can I convert binary numbers to decimal when they are larger .

I am using Excel (MS Office 2003) with the Analysis ToolPak installed. The
function BIN2DEC (and the other related functions) work fine with small
numbers, but give the #NUM display when the value is greater than 10 places.
The help file states that the maximum number of places is 10. Are there any
other functions or any add ins that will handle larger numbers?
  #2   Report Post  
JE McGimpsey
 
Posts: n/a
Default

One way (using a UDF):

Public Function LongBinToDec( _
Optional ByVal sInput As String = "") As Variant
Dim dTemp As Double
Dim i As Long
sInput = Application.Substitute(sInput, " ", "")
If sInput Like "*[!01]*" Then
LongBinToDec = CVErr(xlErrValue)
Else
For i = 1 To Len(sInput)
dTemp = dTemp * 2 + Mid(sInput, i, 1)
Next i
LongBinToDec = dTemp
End If
End Function

If you're unfamiliar with UDFs, see David McRitchie's "Getting Started
with Macros and User Defined Functions":

http://www.mvps.org/dmcritchie/excel/getstarted.htm

In article ,
"Nebulae" wrote:

I am using Excel (MS Office 2003) with the Analysis ToolPak installed. The
function BIN2DEC (and the other related functions) work fine with small
numbers, but give the #NUM display when the value is greater than 10 places.
The help file states that the maximum number of places is 10. Are there any
other functions or any add ins that will handle larger numbers?

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
Binary Numbers longer than 10 characters Andibevan Excel Worksheet Functions 2 April 6th 05 10:08 PM
How to convert Excel imported numbers from text to numbers? Alden Excel Discussion (Misc queries) 9 April 1st 05 09:51 PM
How do I sum hours in Excel and convert to decimal numbers? Heinsohn Excel Discussion (Misc queries) 2 March 5th 05 07:48 PM
convert decimal number to time : convert 1,59 (minutes, dec) to m agenda9533 Excel Discussion (Misc queries) 8 January 20th 05 10:24 PM
How to convert Numbers to text Calif_guy Excel Worksheet Functions 1 November 12th 04 05:12 AM


All times are GMT +1. The time now is 10:56 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"