+ Reply to Thread
Results 1 to 4 of 4

HEX2DEC - Leading 0's

  1. #1
    Registered User
    Join Date
    08-16-2011
    Location
    Dexter, Michigan
    MS-Off Ver
    Excel 2010
    Posts
    5

    HEX2DEC - Leading 0's

    Hi,

    I am working on a project that requires me to convert hex serial numbers into dec while retaining leading zeroes in two segments.

    The serial numbers are basically 8 characters, XX-YYYYYY, and convert into DEC values that are 11 characters ###-######## (2 - 6 into 3 - 8)

    I was trying to use =CONCATENATE(HEX2DEC(LEFT(A2,2)),HEX2DEC(RIGHT(A2,6)))

    This obviously produces the incorrect answer most of the time due to the missing leading 0's in both segments, but I can't figure out the correct code.

    I tried to attach my sheet, hopefully that works.
    Attached Files Attached Files

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: HEX2DEC - Leading 0's

    Try:

    =CONCATENATE(TEXT(HEX2DEC(LEFT(A2,2)),"000"),TEXT(HEX2DEC(RIGHT(A2,6)),"00000000"))
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Registered User
    Join Date
    08-16-2011
    Location
    Dexter, Michigan
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: HEX2DEC - Leading 0's

    Quote Originally Posted by NBVC View Post
    Try:

    =CONCATENATE(TEXT(HEX2DEC(LEFT(A2,2)),"000"),TEXT(HEX2DEC(RIGHT(A2,6)),"00000000"))


    Thank you! This works.

  4. #4
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: HEX2DEC - Leading 0's

    Great.

    Please mark your thread as Solved.

    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

+ 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