+ Reply to Thread
Results 1 to 7 of 7

Convert Characters Based On Custom Map

  1. #1
    Registered User
    Join Date
    05-17-2012
    Location
    Atlanta
    MS-Off Ver
    Excel 2003
    Posts
    4

    Talking Convert Characters Based On Custom Map

    Hi,
    I'm looking for a macro to convert each character in a string into another character based on a custom map. I realize I could use VLOOKUP but then I'd need to somehow break out each character individually, return each value, then concatenate everything back together. It's not ideal. Any help would be much appreciated!

    Thanks!


  2. #2
    Valued Forum Contributor StevenM's Avatar
    Join Date
    03-23-2008
    Location
    New Lenox, IL USA
    MS-Off Ver
    2007
    Posts
    910

    Re: Convert Characters Based On Custom Map

    Can you give us more details?

  3. #3
    Registered User
    Join Date
    05-17-2012
    Location
    Atlanta
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Convert Characters Based On Custom Map

    Sure. Say if a cell contain the value "welcome". In the adjacent cell to the right I'd like the translated/encoded value "SXBO-MX". Each character would be converted based on the attached map.

    w=S
    e=X
    l=B
    c=O
    o=-
    m=M
    e=X

    m_map.xlsx

    Thanks!

  4. #4
    Valued Forum Contributor StevenM's Avatar
    Join Date
    03-23-2008
    Location
    New Lenox, IL USA
    MS-Off Ver
    2007
    Posts
    910

    Re: Convert Characters Based On Custom Map

    See if this works for you.
    For what it is worth, if you mapped your character set to an ASCII order,
    (see: http://www.asciitable.com/) for values 32 to 122,
    then you would only need one Const string, instead of two.

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    05-17-2012
    Location
    Atlanta
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Convert Characters Based On Custom Map

    Thanks Steven, this works great! After assigning sText to reference A1 and returning sResult in B1, how can I repeat it until it reaches the end of the list or the first blank?

    Please Login or Register  to view this content.
    Thanks!

  6. #6
    Valued Forum Contributor StevenM's Avatar
    Join Date
    03-23-2008
    Location
    New Lenox, IL USA
    MS-Off Ver
    2007
    Posts
    910

    Re: Convert Characters Based On Custom Map

    Version 2 works like a UDF and can be used in any column.

    Please Login or Register  to view this content.
    Version 3 takes text in column A and places the code in column B.

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    05-17-2012
    Location
    Atlanta
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Convert Characters Based On Custom Map

    Both are great, thanks again Steven!

+ 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