+ Reply to Thread
Results 1 to 5 of 5

Count spaces between last two words in a text string

  1. #1
    Forum Contributor
    Join Date
    11-02-2007
    Location
    Bryne, Norway
    MS-Off Ver
    Microsoft Office Excel 2010
    Posts
    230

    Count spaces between last two words in a text string

    I want to count spaces between last two words in a text string. Any suggestions?

    See example below.

    Please Login or Register  to view this content.
    Last edited by mkvassh; 10-26-2011 at 03:33 AM.

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

    Re: Count spaces between last two words in a text string

    If the item is in A1, then with a couple of helper columns to get second last and last strings...

    in B1:
    Please Login or Register  to view this content.
    in C1:
    Please Login or Register  to view this content.
    then in D1:
    Please Login or Register  to view this content.
    else if you want it all in one formula:

    Please Login or Register  to view this content.
    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 Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Count spaces between last two words in a text string

    Maybe slightly shorter. (Assumes that there are no preceding duplicates that match the second last column)
    In B2 (Same as NBVC)
    Please Login or Register  to view this content.
    In C2
    Please Login or Register  to view this content.
    Or with one formula
    Please Login or Register  to view this content.
    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.

  4. #4
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,616

    Re: Count spaces between last two words in a text string

    Maybe this:

    Please Login or Register  to view this content.
    Edit: but not if last word is in the string more then once...
    Last edited by zbor; 10-25-2011 at 01:55 PM.

  5. #5
    Forum Contributor
    Join Date
    11-02-2007
    Location
    Bryne, Norway
    MS-Off Ver
    Microsoft Office Excel 2010
    Posts
    230

    Re: Count spaces between last two words in a text string

    Thanks a lot, all of you :-)

+ 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