+ Reply to Thread
Results 1 to 18 of 18

Excel 2008 : Finding Consecutive Identical Upper Case Letters

  1. #1
    Registered User
    Join Date
    05-16-2011
    Location
    Tucson, AZ
    MS-Off Ver
    Excel 2008 For Mac
    Posts
    7

    Finding Consecutive Identical Upper Case Letters

    I downloaded a 1500 line file containing song titles in which all the spaces between words have been omitted. Here is a sample:
    NowIsTheTimeForAllGoodMen(ToComeToTheAidOfTheirCountrymen).mp3

    Some lines contain 25 words and one is 132 chars long.

    In the General forum, I found this formula for determining the location of an upper case letter:
    ={SMALL(FIND(0,SUBSTITUTE(A5,CHAR(ROW(INDIRECT("65:90"))),0)&0),2)}

    Using it, and and LEFT and MID functions repeatedly, I have been able to locate the next upper case letter, add a space before it, isolate each word in a column, and concatenate all the individual words at the end to restore the complete title with spaces between words.

    In general, this works very well, but there are two problems, one I can't easily work around:

    1) Parentheses: Wherever there is a left parenthesis, the space should be added before, not after the parenthesis (which is exactly what I told it to do). I can do a simple replace at the end to fix it, but perhaps there is a more elegant method.
    2) Consecutive Identical Upper Case Letters: If there are two or more uppercase letters in a row which are identical, only the first one is picked up by the SMALL function. This is NOT easy to work around and is where I really need help.

    Here is the end result using the example provided above:
    Now Is TheTime For All Good Men( To Come ToThe Aid Of Their Countrymen).mp3

    This is my first post, sorry if I violated any rules.
    Last edited by mikeaq; 05-19-2011 at 06:26 PM. Reason: SOLVED

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Finding Consecutive Identical Upper Case Letters

    Probably going to require some VBA....

    http://www.ozgrid.com/Excel/excel-text-space.htm
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Forum Contributor johnjohns's Avatar
    Join Date
    11-19-2007
    Location
    Dubai, UAE
    MS-Off Ver
    2003 and 2007
    Posts
    526

    Re: Finding Consecutive Identical Upper Case Letters

    Perhaps this also. Selecting the range and running this macro
    Please Login or Register  to view this content.
    regards

    johnjohns

    When you are not sure where to go, every road takes you there!

  4. #4
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Finding Consecutive Identical Upper Case Letters

    Please Login or Register  to view this content.



  5. #5
    Forum Contributor johnjohns's Avatar
    Join Date
    11-19-2007
    Location
    Dubai, UAE
    MS-Off Ver
    2003 and 2007
    Posts
    526

    Re: Finding Consecutive Identical Upper Case Letters

    Also I think I could have shortened one line to
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    05-16-2011
    Location
    Tucson, AZ
    MS-Off Ver
    Excel 2008 For Mac
    Posts
    7

    Re: Finding Consecutive Identical Upper Case Letters

    Thanks, but I use Excel 2007 for Mac from which VBA has been deleted, and anyhow, whatever little I knew about VBA has gone. Any ideas using standard functions?

  7. #7
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Finding Consecutive Identical Upper Case Letters

    One of the advantages of XL2007 and later versions is the increased number of nested functions allowed.... Although it would be nice if the changed the SUBSTITUTE and REPLACE function to accept arrays....

    Anyways try this formula:

    Please Login or Register  to view this content.
    Where A1 is cell containing text string (you only have to replace it once in the formula burried in the middle)

  8. #8
    Registered User
    Join Date
    05-16-2011
    Location
    Tucson, AZ
    MS-Off Ver
    Excel 2008 For Mac
    Posts
    7

    Re: Finding Consecutive Identical Upper Case Letters

    Quote Originally Posted by NBVC View Post
    One of the advantages of XL2007 and later versions is the increased number of nested functions allowed.... Although it would be nice if the changed the SUBSTITUTE and REPLACE function to accept arrays....

    Anyways try this formula:

    Please Login or Register  to view this content.
    Where A1 is cell containing text string (you only have to replace it once in the formula burried in the middle)
    Fantastic! A brute force solution (though a lot less brutal than mine!) but works like a charm - many thanks!

  9. #9
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Finding Consecutive Identical Upper Case Letters

    How about a UDF?
    Please Login or Register  to view this content.

    Enter in worksheet so
    Please Login or Register  to view this content.


    Hope this helps
    Attached Files Attached Files
    Last edited by Marcol; 05-16-2011 at 12:46 PM. Reason: Updated workboook to use replace rather than substitute.
    If you need any more information, please feel free to ask.

    However,If this takes care of your needs, please select Thread Tools from menu above and set this topic to SOLVED. It helps everybody! ....

    Also
    اس کی مدد کرتا ہے اگر
    شکریہ کہنے کے لئے سٹار کلک کریں
    If you are satisfied by any members response to your problem please consider using the small Star icon bottom left of their post to show your appreciation.

  10. #10
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Finding Consecutive Identical Upper Case Letters

    Marcol,

    It was established that the OP cannot use macros....

  11. #11
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Finding Consecutive Identical Upper Case Letters

    Sorry NBVC missed post #6. Might be useful to someone else if they are reading this thread.

  12. #12
    Registered User
    Join Date
    05-16-2011
    Location
    Tucson, AZ
    MS-Off Ver
    Excel 2008 For Mac
    Posts
    7

    Re: Finding Consecutive Identical Upper Case Letters

    Thanks, however I am not a programmer so I probably posted this in the wrong forum in the first place. Also, MS removed VBA from XL For Mac 2007 for some reason. The non-VBA solution above by NVBC worked perfectly!

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

    Re: Finding Consecutive Identical Upper Case Letters

    I'd do it all in word then paste back into excel
    find
    [A-Z]
    replace with (making sure wild cards is selected)
    ^&
    "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

  14. #14
    Registered User
    Join Date
    05-16-2011
    Location
    Tucson, AZ
    MS-Off Ver
    Excel 2008 For Mac
    Posts
    7

    Re: Finding Consecutive Identical Upper Case Letters

    Your solution is simple, elegant and does work -- but first I had to figure out that you omitted the "^s" in front of the ^&", so that the replace with should read "^s^&". I have never used the wild card option in WORD - really powerful.

    BTW: I know the "^s" is documented in WORD and stands for a non-breaking space, but the "^&" doesn't seem to be. I gather it means replace whatever you find with whatever you found.

    Thanks!

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

    Re: Finding Consecutive Identical Upper Case Letters

    sorry you could just use x^& where x = a single space

  16. #16
    Registered User
    Join Date
    05-16-2011
    Location
    Tucson, AZ
    MS-Off Ver
    Excel 2008 For Mac
    Posts
    7

    Re: Finding Consecutive Identical Upper Case Letters

    I followed the instructions to change this to SOLVED but it doesn't seem to show as such when I look at the post outside of edit mode. What am I missing???

  17. #17
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Finding Consecutive Identical Upper Case Letters

    The 2008 help forum has a quirk in it that doesn't allow the editing to mark the thread Solved... Just leave it.

  18. #18
    Registered User
    Join Date
    05-16-2011
    Location
    Tucson, AZ
    MS-Off Ver
    Excel 2008 For Mac
    Posts
    7

    Re: Finding Consecutive Identical Upper Case Letters

    Then I suggest you omit the words

    "Please also mark the thread as Solved once it is solved. Check the FAQ's to see how."

    and substitute the words

    "The 2008 help forum has a quirk in it that doesn't allow the editing to mark the thread Solved... Just leave it."

    in your boilerplate reply.

    No point a newbie wasting time trying to do it and the being told he/she can't do it after asking him/her to do it!

    More to the point, I am impressed by the expertise of all who helped, and appreciate the many and varied solutions offered me in such a short period of time.

+ 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