Results 1 to 8 of 8
  1. #1
    Platinum Lounger
    Join Date
    Feb 2002
    Location
    A Magic Forest in Deepest, Darkest Kent
    Posts
    5,681
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Decimal to Binary (XP)

    Absolutely brilliant, great find and one I suggest people should bookmark. Thank you this will do the trick I have gone past Dec (100000) and is still shunting through.

    Any way for quick reference to others and in case this link dies the formula is:

    =SUMPRODUCT(INT(MOD(Number/2^(COLUMN(1:1)-1),2))*10^(COLUMN(1:1)-1))
    Jerry

  2. #2
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts

    Re: Decimal to Binary (XP)

    If you want a function which can be used in Excel or VB try this:

    <pre>Option Explicit
    Function MyBin2Dec(sNum As String) As Long
    Dim x As Integer
    Dim iLen As Integer
    iLen = Len(sNum) - 1
    For x = 0 To iLen
    MyBin2Dec = MyBin2Dec + _
    Mid(sNum, iLen - x + 1, 1) * 2 ^ x
    Next
    End Function</pre>


    Steve

  3. #3
    Platinum Lounger
    Join Date
    Feb 2002
    Location
    A Magic Forest in Deepest, Darkest Kent
    Posts
    5,681
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Decimal to Binary (XP)

    Thanks Steve

    That is a nice one to know and one I will squirrel away for another day. There are a few grammatical errors in my original post ( which I will change now) but I was looking more for DEC2BIN but the nested formula that Hans pointed me to will do the job perfectly at the moment. <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>
    Jerry

  4. #4
    Platinum Lounger
    Join Date
    Feb 2002
    Location
    A Magic Forest in Deepest, Darkest Kent
    Posts
    5,681
    Thanks
    0
    Thanked 1 Time in 1 Post

    Decimal to Binary (XP)

    <P ID="edit" class=small>(Edited by Jezza on 28-Sep-05 09:41. to get rid of some horrific grammar errors...OK it was late and I wrote phonetically)</P>I am currently writing a programme that requires me to use the values 1 and 0 as markers to allow my function to work. I have decided that as I am looking for a numerical pattern to be returned in my result that I could use a binary string to make these markers.

    My problem:

    I am using the DEC2BIN function in this format =DEC2BIN(A1,9) this returns 000000001 and I am running up to 511 returning 111111111.

    This is fine for the initial tests of my programme but I am at a loss to finding a conversion code on the internet examples I have seen so far only do binary to decimal conversion in VBA. Is anybody aware of an add-in or snippet which could assist me. I would prefer to go above dec(511) as this provides me with only a 9 digit binary number..any ideas?
    Jerry

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Decimal to Binary (XP)

    See <A target="_blank" HREF="http://www.dicks-blog.com/archives/2004/12/20/replacing-the-analysis-toolpak-addin-part-3/">Daily Dose of Excel

  6. #6
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts

    Re: Decimal to Binary (XP)

    Brain fart on my end.

    I misread what you were after and happened to have created this function earlier for another reason...

    Steve

  7. #7
    3 Star Lounger
    Join Date
    Apr 2004
    Location
    Albuquerque, New Mexico, USA
    Posts
    233
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Decimal to Binary (XP)

    There are 10 kinds of people that understand binary numbers, those that do and those that don

  8. #8
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts

    Re: Decimal to Binary (XP)

    Yes and that stat was in puzzles a while back...<post#=516,850>post 516,850</post#>

    Steve

Posting Permissions

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