+ Reply to Thread
Results 1 to 20 of 20

64 bit binary conversion

  1. #1
    Registered User
    Join Date
    08-11-2014
    Location
    Israel
    MS-Off Ver
    2013
    Posts
    19

    64 bit binary conversion

    Hello,
    I'm new to this forum.
    I'm trying to convert large decimal numbers to binary. Excel alone doesn't support that of course (DEC2BIN is very limited).
    I need a formula that will get as inputs a decimal number and the number of output bits. The output should be the binary number, split to the cells under the decimal one if possible, and padded with zeros according to the number of bits.
    This function is aimed to create a bitmap out of a decimal number.

    I found a very good partial answer in this thread:
    http://www.excelforum.com/excel-prog...it-binary.html

    As i mentioned i'm very new to this forum and never used visual basic functions in excel. So please be as detailed as you can in the answer. on the thread mentioned before i was told to hit Alt+F11 and put it in a new module. These are not enough details for me need detailed tasks, how and where to push and paste, how to save, what does it mean, and how to use the function afterwards..

    Thank you very much in advance!

    Alon

  2. #2
    Forum Expert
    Join Date
    05-01-2014
    Location
    California, US
    MS-Off Ver
    Excel 2010
    Posts
    1,795

    Re: 64 bit binary conversion

    Quote Originally Posted by alonglick View Post
    I'm trying to convert large decimal numbers to binary.
    [....]
    I found a very good partial answer in this thread:
    http://www.excelforum.com/excel-prog...it-binary.html

    As i mentioned i'm very new to this forum and never used visual basic functions in excel. So please be as detailed as you can in the answer. on the thread mentioned before i was told to hit Alt+F11 and put it in a new module. These are not enough details for me need detailed tasks, how and where to push and paste, how to save, what does it mean, and how to use the function afterwards.
    I'm afraid I do not have time now to walk you through it. I'm sure someone else will.

    But I wanted to caution you that even though the UDF supports integers as large as 2^63-1 (i.e. 64-bit signed integers), if your integers have more than 15 significant digits, you will need to input them as text.

    The previous discussion (in 2010) referred to input using a CSV file. If the file contains the number 1,234,567,890,123,456,789, for example, and you open it directly in Excel, Excel will interpert the number as 1,234,567,890,123,450,000, even if the number is quoted in the CSV file.

    Instead, you need to import the file as a text file, and you need to set the imported column to type Text. (FYI, you do not need to change the file extension to ".txt", as some responders might say.)

    Those might be some additional instructions you need more details about.

  3. #3
    Registered User
    Join Date
    07-22-2014
    Location
    Riyadh
    MS-Off Ver
    2010
    Posts
    88

    Re: 64 bit binary conversion

    hi

    http://www.ablebits.com/office-addin...a-macro-excel/
    thanks

  4. #4
    Registered User
    Join Date
    08-11-2014
    Location
    Israel
    MS-Off Ver
    2013
    Posts
    19

    Re: 64 bit binary conversion

    Thanks guys for the answers.
    Maybe i should ask a more simple question - Is there a way to do just a decimal to binary up to 64 bit? no need to spread it to columns cause i guess this excel can do.
    Thank you!

  5. #5
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: 64 bit binary conversion

    try the code posted here
    http://stackoverflow.com/questions/2...-large-numbers
    =DecToBin(A1,64)
    where a1 contains text 1234567890123456789 gives 0001000100100010000100001111010001111101111010011000000100010101
    you can copy/paste back special values and split to columns using text to columns fixed width or just usa a mid() formula
    Attached Files Attached Files
    Last edited by martindwilson; 08-11-2014 at 07:26 AM.
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  6. #6
    Registered User
    Join Date
    08-11-2014
    Location
    Israel
    MS-Off Ver
    2013
    Posts
    19

    Re: 64 bit binary conversion

    Thank you very much martindwilson.
    It looks great BUT after downloading the file and "Enable content" and "Enable Editing" it gives me an "Compile error: can't find project or library".
    What should i do to get it working. i think this is exactly the function i was looking for.
    Thank you!

  7. #7
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: 64 bit binary conversion

    i havent got 2013 so what bit highlites in the debug?

  8. #8
    Registered User
    Join Date
    08-11-2014
    Location
    Israel
    MS-Off Ver
    2013
    Posts
    19

    Re: 64 bit binary conversion

    Str$
    does it make sense?
    Thanks!

  9. #9
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: 64 bit binary conversion

    It's happening because of missing references.

    In Excel spreadsheet Press Alt+T+I and enable (Give Tick in) Solver Addin and give Ok...


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  10. #10
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,464

    Re: 64 bit binary conversion

    Not sure it's anything to do with the version of Excel. I've just tried the .xlsm file in Excel 2007 and get Str$ highlighted. The MISSING reference refers to SOLVER.XLAM

    Just going to try and find that and see what happens.


    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  11. #11
    Registered User
    Join Date
    08-11-2014
    Location
    Israel
    MS-Off Ver
    2013
    Posts
    19

    Re: 64 bit binary conversion

    I tried the solver addin and it didn't help
    any other options?
    Thanks!

  12. #12
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: 64 bit binary conversion

    Try:
    Please Login or Register  to view this content.

  13. #13
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,464

    Re: 64 bit binary conversion

    I just unticked the MISSING reference and it compiled OK.

    And, as it implies, 79228162514264337593543950245 is the highest number but you need to convert it with:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    which returns: 111111111111111111111111111111111111111111111111111111111111111111111111111111111111111110100101

    Regards, TMS
    Last edited by TMS; 08-12-2014 at 07:11 AM.

  14. #14
    Registered User
    Join Date
    08-11-2014
    Location
    Israel
    MS-Off Ver
    2013
    Posts
    19

    Re: 64 bit binary conversion

    YEAH!!!! working!
    Thanks a lot
    what was the problem?

  15. #15
    Registered User
    Join Date
    08-11-2014
    Location
    Israel
    MS-Off Ver
    2013
    Posts
    19

    Re: 64 bit binary conversion

    Where do you "untick" it?

  16. #16
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: 64 bit binary conversion

    Tools->References

  17. #17
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,464

    Re: 64 bit binary conversion

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.


    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save


    You may also want to consider thanking those people who helped you by clicking on the little star at the bottom left of their reply to your question.

  18. #18
    Registered User
    Join Date
    08-11-2014
    Location
    Israel
    MS-Off Ver
    2013
    Posts
    19

    Re: 64 bit binary conversion

    Got it.
    Thank you!!

  19. #19
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: 64 bit binary conversion

    Thanx for the assist guys

  20. #20
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,464

    Re: 64 bit binary conversion

    @Martin: You're welcome.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. decimal to 16 bits binary conversion in Excel?
    By xcgames in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-05-2019, 09:15 AM
  2. [SOLVED] Signed Binary Decimal (B16) Conversion
    By Talamon in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-15-2014, 03:34 PM
  3. binary conversion
    By binaryuser in forum Excel General
    Replies: 1
    Last Post: 09-08-2006, 09:58 AM
  4. [SOLVED] Hexadecimal to Binary Conversion
    By sean_f in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-04-2006, 04:05 PM
  5. [SOLVED] decimal to binary conversion
    By tam in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 09-29-2005, 01:05 PM

Tags for this Thread

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