+ Reply to Thread
Results 1 to 8 of 8

Very Large Crime Database and I need to apply proper codes to it

  1. #1
    Forum Contributor
    Join Date
    03-06-2015
    Location
    houston, tx
    MS-Off Ver
    MS 365
    Posts
    522

    Very Large Crime Database and I need to apply proper codes to it

    I have a data base with 20 columns and 30,000 rows of data. The key column is the one which has the Offense Code. The codes are both numbers and some with number and letter. And if there is a letter behind the number it could have one space or two space or three space...like this 02101 A, or 02777 Z or 30400 C. In these examples the first has three spaces and then 2 and then 1.

    I tried to use VLookup to give these codes the proper index code which is shown in the orange column heading with the proper Description. However, I am not able to successfully sort by lowest to highest because of the various letters behind the numbers and also the way the numbers are arranged.

    The columns highlighted in yellow shows the way the codes are being displayed after sorting from lowest to highest. The orange columns are the correct codes and descriptions but they are not in the same order as the ones in the yellow after sorting. The green columns represent the way I want the columns and rows to looks like after all is done. In some cases there will be "more' or "less" codes depending on the crime for that month. But all codes will be used during the year as each month crime report will have some or all codes.

    Any suggestion would be helpful. I have multiple years of data that I will have to work through. If I can find a formula that works, I can save myself weeks of work. Thank you as always.
    Attached Files Attached Files

  2. #2
    Forum Contributor
    Join Date
    03-06-2015
    Location
    houston, tx
    MS-Off Ver
    MS 365
    Posts
    522

    Re: Very Large Crime Database and I need to apply proper codes to it

    Here is one on many database (SHORTENED) files that I have to convert. If you use my earlier attachment and see this attachment, then you can get an idea of what I am trying to do. The yellow highlight columns are the actual database. The Green columns are what I want to have after conversion using Vlookup or a program that can automatically assign the new code and description.
    Since the actual database column represents the"Code Order in the File", I have not been able to properly sort it so that the Codes Needed in Green can be placed automatically. Hope I explained good enough. Thanks
    Attached Files Attached Files

  3. #3
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2502
    Posts
    13,702

    Re: Very Large Crime Database and I need to apply proper codes to it

    I am not sure I can do anything with this. I am not able to discern any consistent pattern(s).

    Can you tell me why there are no 'SHORT CODE INDEXes' = 1? They jump from 0 to 2 for no apparent reason. Why are the 100's 'SHORT CODE' =0?
    Dave

  4. #4
    Forum Contributor
    Join Date
    03-06-2015
    Location
    houston, tx
    MS-Off Ver
    MS 365
    Posts
    522

    Re: Very Large Crime Database and I need to apply proper codes to it

    Dave

    No short codes in 1 is because I left a blank cell there. They jump because order of the codes in yellow highlight represent different crimes. The 50 will index to a Burglary and the Short Code for that is a "5". There is also codes in yellow highlight like "103" that represent the crime of Murder by Firearm, but the Short Code is a "0" and the short description is "Murder".
    When I sort from small to largest for the Codes in yellow highlight called "Code Order In File", this is the manner in which they sorted. Some of the codes in yellow highlight have "letters" and that prevents the numbers from sorting in the small to largest order. I hope I explain. thanks for looking into this for me

  5. #5
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2502
    Posts
    13,702

    Re: Very Large Crime Database and I need to apply proper codes to it

    OK.

    That still leaves us with no consistent patterns that I can "translate" into Excel.

    I have some other thoughts. They are best sent in a PM. I'll do that.

  6. #6
    Forum Contributor
    Join Date
    03-06-2015
    Location
    houston, tx
    MS-Off Ver
    MS 365
    Posts
    522

    Re: Very Large Crime Database and I need to apply proper codes to it

    Here is the data base. The only columns needing to be vlookup are "Offense Code" and the long description from the code sheet and then the Short code and short description.
    Attached Files Attached Files

  7. #7
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    Re: Very Large Crime Database and I need to apply proper codes to it

    What is it you actually want to do with this 'database'?
    If posting code please use code tags, see here.

  8. #8
    Forum Contributor
    Join Date
    03-06-2015
    Location
    houston, tx
    MS-Off Ver
    MS 365
    Posts
    522

    Re: Very Large Crime Database and I need to apply proper codes to it

    To add the proper Description using the code index highlighted in orange in my other posts and then apply the short code and short description to all.
    The attached file has various columns but the only one I want to use is the one in yellow highlight. That is a part of the file. the columns with orange and
    green are what I want to add using the Code Index and then the short code and short description.

    Hope this clarifies.
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. How to apply the codes for 2 columns in For each... in...
    By fluffyvampirekitten in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-31-2015, 02:34 AM
  2. How Do I Apply the Same Formula to the Entire Workbook? I.E Trim & Proper
    By Inframan in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-21-2013, 08:16 PM
  3. [SOLVED] APPLY Header Codes
    By diakonos1984 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-03-2013, 03:48 PM
  4. [SOLVED] Using VLookUp in VBA Form, Apply Values Only to Proper Cell
    By tsamuels in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 01-26-2013, 08:23 AM
  5. [SOLVED] Proper way to apply conditional formatting to new entries of data.
    By Melvinrobb in forum Excel General
    Replies: 6
    Last Post: 07-09-2012, 03:08 PM
  6. How to apply a proper date format to an entire column?
    By anb001 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 12-03-2008, 03:47 PM
  7. Replies: 0
    Last Post: 04-28-2006, 01:00 PM

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