+ Reply to Thread
Results 1 to 9 of 9

Making A Letter Equal A Word In Another Cell

Hybrid View

  1. #1
    Registered User
    Join Date
    03-14-2013
    Location
    Seattle, WA
    MS-Off Ver
    Excel 2007
    Posts
    3

    Making A Letter Equal A Word In Another Cell

    So, here is my issue. I have this project for work where on one sheet information is put in by typing AF, CF, WF. I need to have Excel read the AF, CF, WF and make that read as the full word. Is there anyway to do that? I can get my boss to have people just put A, C, W. I know having people just type the full word would be easiest but I know they won't go for it.

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,412

    Re: Making A Letter Equal A Word In Another Cell

    You could set up a 2-column table somewhere with the initials in one column and the corresponding word in the other, and then you would be able to use the VLOOKUP function to convert the intiials into the word.

    Hope that helps.

    Pete

  3. #3
    Registered User
    Join Date
    03-14-2013
    Location
    Seattle, WA
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Making A Letter Equal A Word In Another Cell

    Could I set it up so that if the cell says X the it will do that?

  4. #4
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,412

    Re: Making A Letter Equal A Word In Another Cell

    I don't know what you mean. Post an example workbook (the FAQ describes how to), so it might better illustrate what you are trying to achieve.

    Pete

  5. #5
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Making A Letter Equal A Word In Another Cell

    Ok


    This is the code that you need.

    Right click on your sheet name at the bottom of excel. Select view code. Paste this and close rhe window

    Wherever you type your codes on that sheet, the codes will be changed to the text Detailed below

    The code is easy to modify so........................

    Enjoy.


    Public changeflag As Integer
    Dim temp, temp2 As String
    
    
    Private Sub Worksheet_Change(ByVal Target As Range)
    
    If changeflag = 1 Then GoTo 10
    changeflag = 1
    codes = Array("af", "AF", "cf", "CF", "wf", "WF")
    
    CODES2 = Array("African Food", "AFRICAN FOOD", "Chineese Food", "CHINEESE FOOD", "Western Food", "WESTERN FOOD")
    
    If Target.Cells.Count > 1 Or InStr(Join(codes), temp) = 0 Or Len(Target.Cells.Value) > 2 Then GoTo 10
    
    Range(Target.Cells.Address).FormulaR1C1 = CODES2((InStr(Join(codes), Target.Cells.Value) - 1) / 3)
    
    10 changeflag = 0
    End Sub
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    03-06-2013
    Location
    Hull, England
    MS-Off Ver
    Excel 2007
    Posts
    1

    Re: Making A Letter Equal A Word In Another Cell

    Hi Mehmetcik, I was very interested in your spreadsheet with the code and so I had a look at it, it works just fine and as you say it's easy to add additional words into the code, I have noticed tho if say you type "cf" and press enter you get exactly what the code says "chineese food" however if you happen to drag this cell to another location in the sheet, the cell you dragged it from always displays "african food" can this be stopped?

    great bit of code tho, Thanks
    Tony

  7. #7
    Registered User
    Join Date
    03-14-2013
    Location
    Seattle, WA
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Making A Letter Equal A Word In Another Cell

    So I need Visual Basic installed? All I have is the regular Office 2007 suite.

  8. #8
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Making A Letter Equal A Word In Another Cell

    regular office comes with VBA already built in, but you do not need to use VBA, Pete's suggestion will work just fine.

    Just create a table (anywhere, out of the way) with the letters in 1 column, and the words in the next column. Then use a simple vlookup() to return the word, based on the letter entered
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  9. #9
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Making A Letter Equal A Word In Another Cell

    sorry it cant be done easily

+ 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