+ Reply to Thread
Results 1 to 5 of 5

Entering a number that converts to text

Hybrid View

  1. #1
    Registered User
    Join Date
    11-19-2012
    Location
    Northern Ireland
    MS-Off Ver
    Excel 2003
    Posts
    1

    Entering a number that converts to text

    This is my first post, so I trust I make myself clear!

    I am entering a large amount of data into a spreadsheet. One of the rows is titled 'Operative', where a staff name is entered. Would it be possible if I were to assign each member of staff a number (e.g. 04), when I enter that number into the cell, it automatically changes that number to the staff member's name (e.g. Mark).

    I hope you understand what I mean, and can see the benefits of this, saving me typing more characters than necessaries into each row!

    Any help would be appreciated.

    Andy

  2. #2
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Entering a number that converts to text

    Use data validation http://www.contextures.com/xlDataVal01.html
    If solved remember to mark Thread as solved

  3. #3
    Forum Contributor
    Join Date
    08-23-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    163

    Re: Entering a number that converts to text

    I think vlookup might help....

    Create a master of emp name and emp code and then use lookup. Please find attached the sample file for reference.
    Attached Files Attached Files

  4. #4
    Valued Forum Contributor
    Join Date
    03-17-2012
    Location
    Warsaw, Poland
    MS-Off Ver
    2007/2010
    Posts
    555

    Re: Entering a number that converts to text

    Private Sub Worksheet_Change(ByVal Target As Range)
    
    Select Case Target.Value
    
    Case Is = 1
    Target.Value = "John"
    Case Is = 2
    Target.Value = "Tom"
    End Select
    
    End Sub
    this goes into the worksheet module of the affected worksheet.

    Not really sure how to make it work for numbers with two preceeding zeros. The downside of this code is that you wont be able to enter either 1 nor 2 in the worksheet.

    You could alter it to do those changes only in a desired range:

    
    Private Sub Worksheet_Change(ByVal Target As Range)
    
    set mRange = Range("A1:A20")
    
    if not intersect(mRange,Target) is nothing then
    
    Select Case Target.Value
    
    Case Is = 1
    Target.Value = "John"
    Case Is = 2
    Target.Value = "Tom"
    End Select
    
    end if
    
    End Sub
    Last edited by Bishonen; 11-19-2012 at 06:54 AM.
    If you think that my answer was helpful, please click on the "Add to this user's Reputation" button.

  5. #5
    Forum Contributor
    Join Date
    08-22-2012
    Location
    Bhubaneswar
    MS-Off Ver
    Excel 2007
    Posts
    100

    Re: Entering a number that converts to text

    @andrew

    Hi

    Firstly Welcome to this Forum

    i agree with patel45 it is better and simple for you

    other wise you have to create on Name Range and in the name you have to mention the Names then afer u can use the below formula

    for A1 IN B1

    =IF(A1="","" ,INDEX(DEALER_NAME,A1))

    With the Above Formula when you enter the No. 1 then in b1 It will display the Name

    Hope it will work, other wise please inform us with a sample Workbook

    Thanks

    Patnaik

+ 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