Results 1 to 6 of 6

Thread: Converting the floating point number to the hexadecimal on the Microsoft Excel 2010

  1. #1
    Join Date
    Jun 2006
    Posts
    65

    Converting the floating point number to the hexadecimal on the Microsoft Excel 2010

    I had recently upgraded to Microsoft Office 2010 on my system. I want some help to I convert the floating number into hex representation. I am unable to find any option to do the same. I am having a series of excel sheet which has this digits in it. I am not able to find any third party plugin also that can provide me option to convert the floating point to hexadecimal. I hope this might be working.

  2. #2
    Join Date
    Jun 2009
    Posts
    1,518

    Re: Converting the floating point number to the hexadecimal on the Microsoft Excel 2010

    Excel supports a HEX2DEC function. I am going to give you a link below which gives you enough information through which you can use this function. In the below link at the end you can find some formula that can help you what you are looking for. Just visit the link and see whether you are able to get a proper solution or not.

    HEX2DEC function

  3. #3
    Join Date
    Nov 2008
    Posts
    1,514

    Re: Converting the floating point number to the hexadecimal on the Microsoft Excel 2010

    Well looking at the requirement of yours I am suggesting following code which you can run and see whether it is helpful to you.

    Code:
    Function Sng2String(s As Single) As String
        ' shg 2008-0919
        
        ' Returns the conversion of float s to a hex string
        
        Const sPad As String = "00000000"
        Dim uf As uFlt
        Dim ul As uLng
        
        uf.f = s
        LSet ul = uf
        Sng2String = Right(sPad & Hex(ul.l), 8)
    End Function

  4. #4
    Join Date
    Mar 2009
    Posts
    1,360

    Re: Converting the floating point number to the hexadecimal on the Microsoft Excel 2010

    I am posting following code which you can convert the decimal fraction to the hexadecimal fraction.
    Code:
    ="0." & DEC2HEX(B1*16^B2)
    Here the decimal fraction is B1 and B2 which is defining the number of the hexadecimal plces into the output. So try the function which I have mentioned over here I am hoping that it would be useful to get the requirement of yours.

  5. #5
    Join Date
    Nov 2008
    Posts
    1,259

    Re: Converting the floating point number to the hexadecimal on the Microsoft Excel 2010

    Well I am posting below all the routines which are implemented into the situation of yours which would give you light shed on this particular matter.
    Code:
    '   shg 2008-0919
    '       2009-0517 minor internal changes
    '       2010-0306 added DblMan & DblExp functions
    '       2010-0331 added DbltoBin & Byte2Bin functions
    '       2010-0814 added IntStr2Bin function
    
    '   Routine             Input                   Output             UDF/VBA
    '   --------    -------------------- ---------------------------- -------
    '   Byte2Sng    ab(0 To 3)           Single                       VBA
    '   Sng2Byte    Single               4-byte array Variant         Both
    '   Sng2Hex     Single               Hex String                   Both
    '   Hex2Sng     Hex string           Single                       Both
    '   Var2Sng     4-byte array Variant Single                       Both
    
    '   Routine            Input                   Output             UDF/VBA
    '   --------    -------------------- ---------------------------- -------
    '   Byte2Dbl    ab(0 To 7)           Double                       VBA
    '   Dbl2Byte    Double               8-byte array Variant         Both
    '   Dbl2Hex     Double               Hex string                   Both
    '   Dbl2Bin     Double               Signed binary decimal string Both
    '   Hex2Dbl     Hex string           Double                       Both
    '   Var2Dbl     8-byte array Variant Double                       Both
    '   DblMan      Double               Double (mantissa of input)   Both
    '   DblExp      Double               Long (exponent of input)     Both
    '   IntStr2Bin  Decimal string       64-bit binary string         Both
    
    '   Routine            Input                   Output             UDF/VBA
    '   --------    -------------------- ---------------------------- -------
    '   Flt2Byte    Single or Double     4- or 8-byte array Variant   VBA
    '   Byte2Hex    Byte array           Hex string                   VBA
    '   Byte2Bin    Byte array           Binary string                VBA

  6. #6
    Join Date
    Nov 2008
    Posts
    1,185

    Re: Converting the floating point number to the hexadecimal on the Microsoft Excel 2010

    Let me know whether any of the above mentioned thing worked for you or not. If you have not managed to get the requirement of yours then you should use the below mentioned formula and let me know about the results.
    Code:
    =Sng2String(3.4E+38)

Similar Threads

  1. Converting GPS Co-ordination in Microsoft Excel
    By Kumar esan in forum MS Office Support
    Replies: 2
    Last Post: 15-02-2012, 08:08 PM
  2. floating point issue.Why is it so?
    By maria_megha in forum Software Development
    Replies: 1
    Last Post: 23-07-2011, 04:00 AM
  3. Replies: 6
    Last Post: 12-07-2011, 11:14 AM
  4. Filenames appear as hexadecimal code in excel ?
    By Tufan in forum Windows Software
    Replies: 3
    Last Post: 26-11-2010, 06:17 AM
  5. Replies: 5
    Last Post: 11-03-2010, 05:11 AM

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
  •  
Page generated in 1,711,727,891.47420 seconds with 17 queries