+ Reply to Thread
Results 1 to 6 of 6

LEFT or RIGHT function but counting whole words

  1. #1
    Forum Contributor
    Join Date
    02-09-2007
    Location
    UK
    MS-Off Ver
    2019 & 365
    Posts
    304

    LEFT or RIGHT function but counting whole words

    Hi all,

    I need to use the LEFT & RIGHT function BUT not to count characters but whole words that are seperated by a space.

    Any ideas on a formula / Function I can use?

    Regards & Thanks in advance,

    BVG

  2. #2
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Maybe

    =LEN(TRIM(A1))-LEN(SUBSTITUTE(A1," ",""))+1
    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  3. #3
    Forum Contributor
    Join Date
    02-09-2007
    Location
    UK
    MS-Off Ver
    2019 & 365
    Posts
    304
    That worked, as it always does when you give a solution. Thank you.

    The other problem I have is........

    I have a string of words in a cell (A1) and in A2 I would like the same string of words BUT seperated with a comma between each word.

    Regards BVG

  4. #4
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    See if this helps

    =SUBSTITUTE(TRIM(A1)," ",",")

    VBA Noob

  5. #5
    Forum Contributor
    Join Date
    02-09-2007
    Location
    UK
    MS-Off Ver
    2019 & 365
    Posts
    304
    Perfect. Thank you very much yet again.

    Regards BVG

  6. #6
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    No problem

    Glad it helped

    VBA Noob

+ 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