+ Reply to Thread
Results 1 to 8 of 8

Extract Capitalized Words From String

  1. #1
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Extract Capitalized Words From String

    Hi

    I have these strings in Column B:

    Benzylpenicillin Panpharma pul.t.inj.+inf.,opl.6 mg/ml intravenøst 100 ml kl 00:00 + 100 ml kl 06:00 + 100 ml kl 12:00 + 100 ml kl 18:00
    Digoxin DAK tabletter 62.5 mikg peroralt1 tablet 1 gang(e) Daglig
    Furix tabletter 40 mg peroralt2 tabletter til morgen + 1 tabletter til middag
    Unikalk SIlver tabletter peroralt1 tablet til morgen og til aften
    Ciprofloxacin Fresenius Kabi inf.væske, opløsning 2 mg/ml intravenøst 200 ml kl 08:00 + 200 ml kl 20:00

    I'd like to extract all the Capitalized words in the above strings into Column A such that Column A will reflect this:

    Benzylpenicillin Panpharma
    Digoxin DAK
    Furix
    Unikalk SIlver
    Ciprofloxacin Fresenius Kabi

    I've searched the Web and haven't found any references to this kind of extraction. You're help will be greatly appreciated.

    John
    Last edited by jaslake; 04-12-2010 at 06:39 PM.
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  2. #2
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Extract Capitalized Words From String

    Digoxin DAK tabletter 62.5 mikg peroralt1 tablet 1 gang(e) Daglig does not fit a pattern
    as Daglig is also upper case
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  3. #3
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Extract Capitalized Words From String

    Hi martindwilson

    Ha! I missed that. Been looking at it too long. Well, that aside, can it be done
    extract all the Capitalized words
    I'll deal with the anomalies if I can get a solution to the issue.

    John

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Extract Capitalized Words From String

    Hello John,

    Here is the solution. I ran it against the data the posted and the results match. Give a try on a copy of the actual data and let me know what happens.
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  5. #5
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Extract Capitalized Words From String

    Hi Leith

    As always, your code gives me exactly what I was looking for. I had to add these Dim statements
    Please Login or Register  to view this content.
    You amaze me in your ability to find solutions to our "troubles". Thanks for your help.

    John

  6. #6
    Registered User
    Join Date
    03-25-2010
    Location
    QC, Canada
    MS-Off Ver
    Excel 2007
    Posts
    29

    Smile Re: Extract Capitalized Words From String

    Hi Leith,

    Wow!!! It works for me. However I would like to know how if the data to extraxt is after delimiter as ":" or if data to extract is numerical.

    Thanks

  7. #7
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Extract Capitalized Words From String

    Hello FN2010,

    Regular Expressions can parse almost any type of text. I would need to see before and after samples of what you want. The more the better. You should start a new thread since this one has been marked solved.
    Last edited by Leith Ross; 04-12-2010 at 07:00 PM.

  8. #8
    Registered User
    Join Date
    03-25-2010
    Location
    QC, Canada
    MS-Off Ver
    Excel 2007
    Posts
    29

    Re: Extract Capitalized Words From String

    I will start a new thread, Thanks

+ 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