+ Reply to Thread
Results 1 to 2 of 2

How can I convert binary numbers to decimal when they are larger .

  1. #1
    Nebulae
    Guest

    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. #2
    JE McGimpsey
    Guest

    Re: How can I convert binary numbers to decimal when they are larger .

    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 <[email protected]>,
    "Nebulae" <[email protected]> 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 to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1