+ Reply to Thread
Results 1 to 5 of 5

Excel 2007 : Replace numbers by letters

  1. #1
    Registered User
    Join Date
    05-18-2011
    Location
    Norway
    MS-Off Ver
    Excel 2003
    Posts
    3

    Replace numbers by letters

    Hi

    I have a column where the cells contain two numbers from 0-10 with a / between them, like this: 0/3.
    I want to exchange these numbers with the corresponding letter abbreviations like this:
    0/3 => ME/LG.
    Can this be done?

    Any help is appreciated

  2. #2
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: Replace numbers by letters

    Yes. You can split out the 2 values like this:

    =LEFT(A1,FIND("/",A1)-1)
    =RIGHT(A1,LEN(A1)-FIND("/",A1))

    Create a lookup table holding the values and their text replacements and use VLOOKUP to return them and then combine them again.

    Dom
    "May the fleas of a thousand camels infest the crotch of the person who screws up your day and may their arms be too short to scratch..."

    Use code tags when posting your VBA code: [code] Your code here [/code]

    Remember, saying thanks only takes a second or two. Click the little star to give some Rep if you think an answer deserves it.

  3. #3
    Registered User
    Join Date
    05-18-2011
    Location
    Norway
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Replace numbers by letters

    I can get the cells split into two. However, the vlookup doesn't work on the split cells which has the =left and =right formula in it, it only returns #N/A? When I use vlookup on a cell I just typed the number into vlookup works ? So vlookup doesn't work on the resulting number from a formula?

  4. #4
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: Replace numbers by letters

    I'm guessing that will be because your vlookup table has numeric values in it whereas the formula I posted will return text.

    You could change the formula to:

    =LEFT(A1,FIND("/",A1)-1)*1
    =RIGHT(A1,LEN(A1)-FIND("/",A1))*1

    Which will then return numerics.

    Dom

  5. #5
    Registered User
    Join Date
    05-18-2011
    Location
    Norway
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Replace numbers by letters

    It worked! Thank you very much for your help, Dom!

+ 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