+ Reply to Thread
Results 1 to 8 of 8

How to manage number of words in sentences?

  1. #1
    Registered User
    Join Date
    04-15-2011
    Location
    Sofia
    MS-Off Ver
    Excel 2007
    Posts
    67

    How to manage number of words in sentences?

    In column A i have sentences which of it contain different number of words like this:

    running shoes for women
    walking shoes for kids size 12
    men sneakers and boots


    I want to leave only first two words of every sentence. How can i do this?


    Thanks!
    Last edited by emil9216; 02-01-2013 at 04:25 AM.

  2. #2
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: How to manage number of words in sentences?

    =LEFT(TRIM(A1),SEARCH("@",SUBSTITUTE(TRIM(A1)," ","@",2))-1)
    Does that work for you?
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Registered User
    Join Date
    04-15-2011
    Location
    Sofia
    MS-Off Ver
    Excel 2007
    Posts
    67

    Re: How to manage number of words in sentences?

    It works but, for example, if i want to leave the first 5 words and some of the sentences contain less than 5 words it change the sentences to this: #VALUE!

  4. #4
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: How to manage number of words in sentences?

    =LEFT(TRIM(A1),SEARCH("@",SUBSTITUTE(TRIM(A1)&" "," ","@",5))-1)
    where there are 5 spaces between the quotes TRIM(A1)&" "

  5. #5
    Registered User
    Join Date
    04-15-2011
    Location
    Sofia
    MS-Off Ver
    Excel 2007
    Posts
    67

    Re: How to manage number of words in sentences?

    Thanks, but it still doesn't work.

    example.xlsx

  6. #6
    Forum Expert Ace_XL's Avatar
    Join Date
    06-04-2012
    Location
    UAE
    MS-Off Ver
    2016
    Posts
    6,074

    Re: How to manage number of words in sentences?

    Try this adapted version of ChemistB's formula

    Please Login or Register  to view this content.
    Life's a spreadsheet, Excel!
    Say thanks, Click *

  7. #7
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: How to manage number of words in sentences?

    You didn't put 5 spaces between the quotes. See attached
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    04-15-2011
    Location
    Sofia
    MS-Off Ver
    Excel 2007
    Posts
    67

    Re: How to manage number of words in sentences?

    Thanks! It works.

+ 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