+ Reply to Thread
Results 1 to 2 of 2

subs to translate a series of hex numbers

  1. #1
    Registered User
    Join Date
    02-01-2007
    Posts
    5

    subs to translate a series of hex numbers

    I am a new excel VBA programmer, and I need some big time help.

    I have a sequence of hexadecimal numbers '00 00 00 FF' always in 8 digits in column F and I need to translate them(within column G, and just to the right) into an 5 digit alphanumeric combination like: P1024, U1000.

    Now in the case of this where there are 3 sequences of zeros then I would like to do nothing.

    The key is as such for the first set of 2 numbers:

    00 = P
    01 = C
    10 = B
    11 = U

    and then use the next 4 digits as the code.

    the FF goes into the next column to the right(column H) and is left padded with '0x'


    Any ideas or help would be appreciated?

  2. #2
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    subs to translate a series of hex numbers

    I hardly ever (as in: "Can't remember the last time!") use HEX values, so here's a SWAG at what you might want.....

    A1: (a hex value in the format you posted: xx xx xx xx)
    B1: =LOOKUP(LEFT(A1,2),{"00","01","10","11"},{"P","C","B","U"})&TEXT(HEX2DEC(SUBSTITUTE(MID(A1,4,5)," ","")),"0000")

    If A1: 00 01 01 FF
    the formula returns: P0257

    Am I anywhere near the mark on this one?
    If no...maybe you can explain to me how you want the 2nd and 3rd couplets handled.
    Ron
    Former Microsoft MVP - Excel (2006 - 2015)
    Click here to see the Forum Rules

+ 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