+ Reply to Thread
Results 1 to 11 of 11

How to handle Country Name with 2 words

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

    How to handle Country Name with 2 words

    Hello all!,

    Can someone please offer assistance to this code to achieve what I need.

    The code works as wanted but now I want to extract the country name, so I copied the extract frequency part down to the country section, it works with a country name of one word like Iran, or Greece, but it's not working for two word country name like United Kingdom or Saudi Arabia.

    Can someone offer help to get over this hurdle to handle 2 part country names.

    Thanks!
    Attached Files Attached Files
    ==========
    Bigroo1958
    Austin, Texas
    ==========

  2. #2
    Valued Forum Contributor fredlo2010's Avatar
    Join Date
    07-04-2012
    Location
    Miami, United States
    MS-Off Ver
    Excel 365
    Posts
    762

    Re: How to handle Country Name with 2 words

    Hi,

    Perhaps something like this. I am using the fact that the country name is always bold,

    Please Login or Register  to view this content.
    Thanks

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

    Re: How to handle Country Name with 2 words

    Hi Fredlo 2010,

    Thanks for the reply!!
    I ran your code on the demo I upload and indeed it does extract the country name as I want.

    The issue I am trying to resolve is to incorporate your code into my code to do the same thing. If you look at my code, it inserts 3 columns at A so the details which contains the country name is under column D.
    After the frequency is extract from column D and placed under column A, the frequency is removed from column D, this is when the bold format on the country name is removed for some reason.

    How do I add in your code to work so country name falls under column C?
    Attached Files Attached Files

  4. #4
    Valued Forum Contributor fredlo2010's Avatar
    Join Date
    07-04-2012
    Location
    Miami, United States
    MS-Off Ver
    Excel 365
    Posts
    762

    Re: How to handle Country Name with 2 words

    Try Something Like this

    Please Login or Register  to view this content.
    Thanks

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

    Re: How to handle Country Name with 2 words

    Fredlo2010,

    Thanks for the time you have spent on this for me, it's really appreciated!!
    I believe we are really close now to what I need, there are two items needed to complete this project.

    1. My original code had 2 columns inserted, one for the Frequency, one for the name of the current tab and now you have given me the Country name. I need the third column inserted at column B for the tab name with country name at column C!
    So, it should read Freq, Issue, Country, Details
    [ATTACH]
    348814
    [/ATTACH]

    2. My original code would extract the frequency from the data and insert under column A which is what you have done, but I need the Frequency and the country name removed from the detail!

    Can you add this to the code for me?

    Thanks
    Attached Images Attached Images
    Last edited by bigroo1958; 09-30-2014 at 03:58 PM.

  6. #6
    Valued Forum Contributor fredlo2010's Avatar
    Join Date
    07-04-2012
    Location
    Miami, United States
    MS-Off Ver
    Excel 365
    Posts
    762

    Re: How to handle Country Name with 2 words

    I will help you when I get home tonight. It is not be hard.

    Thanks

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

    Re: How to handle Country Name with 2 words

    Thanks Fredlo2010!!
    I understand!

  8. #8
    Valued Forum Contributor fredlo2010's Avatar
    Join Date
    07-04-2012
    Location
    Miami, United States
    MS-Off Ver
    Excel 365
    Posts
    762

    Re: How to handle Country Name with 2 words

    Hi,

    This should do the trick

    Please Login or Register  to view this content.
    Thanks

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

    Re: How to handle Country Name with 2 words

    Hi Fredlo2010,

    Thanks for the updated code script.
    When I run the updated script on the Demo file I supplied as an attachment, it runs as requested!!

    Then, when I run against the actual data file, I seem to be getting an error "run time error 5 invalid procedure call or argument" at this line

    Cells(i, 3).Value = Right$(Cells(i, 3).Value, Len(Cells(i, 3).Value) - (InStr(1, Cells(i, 3).Value, Cells(i, 3).Value) + Len(Cells(i, 3).Value)))
    I am not too sure what is going on!

  10. #10
    Valued Forum Contributor fredlo2010's Avatar
    Join Date
    07-04-2012
    Location
    Miami, United States
    MS-Off Ver
    Excel 365
    Posts
    762

    Re: How to handle Country Name with 2 words

    I am not sure.

    Make sure your file does not have any missing reference.

    http://www.cpearson.com/excel/missingreferences.aspx

    Thanks

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

    Re: How to handle Country Name with 2 words

    Thanks Fredlo2010!!
    I appreciate your help on my project!!

+ 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. [SOLVED] Convert country words into proper name
    By ka_poroy in forum Excel General
    Replies: 4
    Last Post: 11-18-2013, 03:58 PM
  2. Replies: 1
    Last Post: 02-25-2010, 06:40 AM
  3. Add ‘country name’ column to worksheet from a list of country codes.
    By Ben Morton in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-02-2009, 09:24 AM
  4. [SOLVED] country list
    By BigBloke in forum Excel General
    Replies: 4
    Last Post: 12-12-2005, 07:50 AM
  5. [SOLVED] Country Functions
    By dl in forum Excel General
    Replies: 1
    Last Post: 08-11-2005, 11:05 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