+ Reply to Thread
Results 1 to 3 of 3

Trying to find a way of changing nominal codes into words automatically in excel

Hybrid View

  1. #1
    Registered User
    Join Date
    09-11-2012
    Location
    Northampton
    MS-Off Ver
    Excel 2010
    Posts
    1

    Trying to find a way of changing nominal codes into words automatically in excel

    Hi,

    I am exporting information from an accounts package into Excel. One of the columns is currently imported as Nominal codes e.g. 7804 but i would like Excel to automatically change this to Plant Maint Reps & Rens. There are about 20 nominal codes that i use regularly that i would like to create some kind of code for so i dont have to make the changes manually everytime.

    Any help would be greatly appreciated!!

    Thanks,

    Becky

  2. #2
    Valued Forum Contributor
    Join Date
    05-07-2012
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    354

    Re: Trying to find a way of changing nominal codes into words automatically in excel

    May be:

    1. Create a table of your nominal codes in one column and corresponding words into next. You can then use vlookup function.

    For example: you have nominal codes in AA1:AA20 and corresponding words in AB1:AB20

    Assuming your imported data with nominal codes is in column A. Then

    =vlookup(A2, $AA1:$AB20,2,False) will return matching words.

    Hope this helps.
    Regards,
    Vandan

  3. #3
    Valued Forum Contributor
    Join Date
    03-23-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    1,093

    Re: Trying to find a way of changing nominal codes into words automatically in excel

    If you are looking for a macro that will do this for you, this should work

    Dim c As Range, LR As String    'declare variables
    
    LR = Range("A6555").End(xlUp).Row   'set LR equal to the last row in column A that contains a value
    
    For Each c In Range("A1:A" & LR) 'loop through cells in column A from
                                                   'row 1 to the last row
        Select Case c.Value 'if the current cell in the loop's value is...
            Case 7804   '7804
                c.Value = "Plant Maint Reps & Rens" 'then change the value in the current cell in the loop to Plant Maint Reps & Rens
            Case 1
                c.Value = "list replacement value"
            Case 2
                c.Value = "list replacement value"
            Case 3
                c.Value = "list replacement value"
            Case 4
                c.Value = "list replacement value"
            Case 5
                c.Value = "list replacement value"
            Case 6
                c.Value = "list replacement value"
        End Select
    Next c  'move to next cell in the loop
    To use this in your workbook:

    1. Press Alt+F8 on your keyboard
    2. Clear the Macro Name field and then type AssignNominal
    3. Select the Create option
    4. In between the Sub AssignNominal and End Sub copy and paste the above code
    5. Read through the comments and replace all the Select Case numbers with your nominal codes and the text in between the " " after the c.value = lines of code with what you would like to replace the nominal codes with.
    6. Exit out of VBA
    7. To run the code press Alt+F8
    8. Select the newly created macro and then select the run option.

    Note: This macro assumes your nominal codes are in column A if they are not please update the A's to the column letter of you nominal codes

    Thanks!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

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