+ Reply to Thread
Results 1 to 4 of 4

Options needed to cleanup State list

  1. #1
    Forum Contributor
    Join Date
    11-27-2009
    Location
    Austin, Texas
    MS-Off Ver
    Excel 2013 & 2016
    Posts
    409

    Options needed to cleanup State list

    Hello,

    I download a word document from are website and convert to a excel document. I then link this spreadsheet to an Access database and wish to compare the linked data to data held in the database for updates. The issue I am finding is the Mexican states are in a three letter abbreviation format, whereas the database has a table named tbllocations with states in a two letter format for Mexico. Also, I will add, the spreadsheet state names are not clean, they have full stops on some states.

    This is where I need suggestions as to what is the best approach.

    Would it be easier to convert within the excel spreadsheet the state codes and if so how to do this with VBA at a click of a button, or within Access after the spreadsheet has been linked and convert the state to what is in the tbllocation with a click of a button with VBA code. I could within Access create an update query for each variation but this does not seem too practical.

    Also, I was not too sure if I should place this in the Access or Excel forum

    Thanks
    ==========
    Bigroo1958
    Austin, Texas
    ==========

  2. #2
    Registered User
    Join Date
    11-13-2006
    Posts
    87

    Re: Options needed to cleanup State list

    hey have full stops on some states.
    Don't know what "Full Stop" means.

    Don't know anything about Access, so I would use Excel VBA with two Scripting Dictionaries, one with the three letter names as Keys and the two letter names as Items to convert the 3's to 2's. Then I would run the other Dictionary with the two letter names as keys and "True" as the Items to color the remaining names that could not be recognized by the first Dictionary.

  3. #3
    Forum Contributor
    Join Date
    11-27-2009
    Location
    Austin, Texas
    MS-Off Ver
    Excel 2013 & 2016
    Posts
    409

    Re: Options needed to cleanup State list

    Thanks Sam T for the reply.

    Sorry, Full Stops, I should have said periods in between the letters.
    Would you have an example of the two scripting Dictionaries you mention, not too sure what these are in VBA world or what they do!

  4. #4
    Registered User
    Join Date
    11-13-2006
    Posts
    87

    Re: Options needed to cleanup State list

    You must have a reference set to Microsoft Scripting Runtime.

    Attached is an excerpt from a much larger workbook that uses Dictionaries. For States, no less Well, at least Counties. The States Dictionary only had one entry at the time. I stripped a lot off even the worksheet.

    The example code is all in the Module "UDOs" and references the worksheet "Counties." The notes in blue on Counties is for you.

    In sheet1 is an example of the two lists I think would work for you. The example code is in the sheet2 code module.
    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. Replies: 21
    Last Post: 08-13-2012, 01:52 PM
  2. Pivot Table cleanup help needed
    By sarails in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-19-2011, 10:24 PM
  3. e-mail list management and cleanup of bad names.
    By oldschoolcobra in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-09-2010, 12:40 AM
  4. Need to take my area code list, and make a state list.
    By Tommy1005 in forum Excel General
    Replies: 9
    Last Post: 07-29-2009, 03:55 AM
  5. US State Abbreviations List
    By DTTODGG in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 11-16-2005, 09:40 AM

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