+ Reply to Thread
Results 1 to 9 of 9

How to count all 2 letter words in a cell or group of cells.

  1. #1
    Registered User
    Join Date
    09-19-2019
    Location
    Texas
    MS-Off Ver
    2011 for Mac
    Posts
    1

    Wink How to count all 2 letter words in a cell or group of cells.

    Hello. I'll get right to it for those of you who don't have time for small talk.

    How do I create a formula to count all the two letter words in a single cell or group of cells?

    ex.
    CELL A1 contains a long sentence with the following to letter words: Im, up, it, or, me. (5 two letter words)
    CELL A2 contains the words "at" and "no." (2 two letter words)

    is there a way of only counting those 2 letter words WITHOUT:
    1. splitting the sentence into a million cells, each containing one word and then using the LEN function to count cells containing two character words.
    2. creating a database of all two letter words to search for within those cells.

    The first option is too time consuming to be practical.
    The second option would have to be a huge database containing ALL two letter combinations because the way i need to use this formula will not only apply to two letter "words" but also two letter "combinations." i.e. RN, TX, MU, etc. In addition, I believe this would also only count the cell containing multiple two letter words as ONE instead of tallying the total 2 letters words in that cell.

    Anyway, is this even possible.

    I thank you in advance for any help rendered.

    Best Regards,
    Agustin
    Last edited by njc315; 09-19-2019 at 07:06 AM.

  2. #2
    Forum Expert KOKOSEK's Avatar
    Join Date
    08-03-2018
    Location
    Pole in Yorkshire, UK
    MS-Off Ver
    365/2013
    Posts
    2,767

    Re: How to count all 2 letter words in a cell or group of cells.

    Hmmm I think works fine (NO ITS NOT see comments below):

    DELETE

    EDIT: no, its not fine. In case of 2 letter word and comma straight after it treat it as 3 letter word.
    Last edited by KOKOSEK; 09-19-2019 at 07:28 AM.
    Happy with my answer * Add Reputation.
    If You are happy with solution, please use Thread tools and mark thread as SOLVED.

  3. #3
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: How to count all 2 letter words in a cell or group of cells.

    Please post a sample sheet containing a few rows of REPRESENTATIVE data.

    Unfortunately the attachment icon doesn't work at the moment. So, to attach an Excel file you have to do the following: Just before posting, scroll down to Go Advanced and then scroll down to Manage Attachments. Now follow the instructions at the top of that screen.

    Make sure confidential info is removed first!!!!
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU

  4. #4
    Forum Expert KOKOSEK's Avatar
    Join Date
    08-03-2018
    Location
    Pole in Yorkshire, UK
    MS-Off Ver
    365/2013
    Posts
    2,767

    Re: How to count all 2 letter words in a cell or group of cells.

    A
    B
    1
    ex.
    1
    2
    CELL A1 contains a long sentence with the following to letter words: Im, up, it, or, me. (5 two letter words)
    6
    3
    CELL A2 contains the words "at" and "no." (2 two letter words)
    2
    4
    is there a way of only counting those 2 letter words WITHOUT:
    2
    5
    1. splitting the sentence into a million cells, each containing one word and then using the LEN function to count cells containing two character words.
    1
    6
    2. creating a database of all two letter words to search for within those cells.
    2

    A
    B
    2
    CELL A1 contains a long sentence with the following to letter words: Im, up, it, or, me. (5 two letter words)
    =CountXWords(A2)
    Sheet: Sheet1

    For some unknown reason firewall treat this function like SQL injection and blocked post so unfortunately as picture:

    qq.JPG


    EDIT: with checking that A1 and A2 is not a word.
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by KOKOSEK; 09-20-2019 at 05:42 PM.

  5. #5
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 V 2506
    Posts
    13,785

    Re: How to count all 2 letter words in a cell or group of cells.

    ex.
    .....
    The first option is too time consuming to be practical.
    The second option would have to be a huge database containing ALL two letter combinations because the way i need to use this formula will not only apply to two letter "words" but also two letter "combinations." i.e. RN, TX, MU, etc. In addition, I believe this would also only count the cell containing multiple two letter words as ONE instead of tallying the total 2 letters words in that cell.
    Perhaps not. For example in the attached is a lookup table with all combinations a-z&a-z. It is named alpha_2. The formula to concatenate those is
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Then to count those in B1 and filled down.
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Dave

  6. #6
    Forum Expert KOKOSEK's Avatar
    Join Date
    08-03-2018
    Location
    Pole in Yorkshire, UK
    MS-Off Ver
    365/2013
    Posts
    2,767

    Re: How to count all 2 letter words in a cell or group of cells.

    Key is to predict and remove all alphanumerics which can appear near letters (!?;.,()[] etc.)
    Then it can be 'bite from few sides'.

  7. #7
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,478

    Re: How to count all 2 letter words in a cell or group of cells.

    Quote Originally Posted by KOKOSEK View Post
    For some unknown reason firewall treat this function like SQL injection and blocked post so unfortunately as picture:
    I got caught with that not too long ago... the problem is the consecutive Replace function calls. If you put a space after each Replace's opening parenthesis, the code can be posted.

  8. #8
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,478

    Re: How to count all 2 letter words in a cell or group of cells.

    Quote Originally Posted by KOKOSEK View Post
    Key is to predict and remove all alphanumerics which can appear near letters (!?;.,()[] etc.)
    Then it can be 'bite from few sides'.
    Here is the UDF (user defined function) that I came up with (it uses a different approach than you outlined above)...
    Please Login or Register  to view this content.
    Note: This code will not count letter/number combinations (such as A2 or 12).

  9. #9
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 V 2506
    Posts
    13,785

    Re: How to count all 2 letter words in a cell or group of cells.

    Quote Originally Posted by Rick Rothstein View Post
    I got caught with that not too long ago... the problem is the consecutive Replace function calls. If you put a space after each Replace's opening parenthesis, the code can be posted.
    Yup.
    Wrapping REPLACE in color tags also works.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Generate random group of words in a cell from a large group word list in column
    By faizzsheikh in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 07-26-2018, 10:16 AM
  2. Posting a letter over a group of cells
    By Loski in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-12-2016, 06:55 AM
  3. Removing a beginning letter in a group of cells
    By cfowler09 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-28-2014, 11:16 AM
  4. Replies: 9
    Last Post: 12-09-2010, 04:14 PM
  5. How can I hide the words of a cell (or a group of cells)...
    By Octavio in forum Excel - New Users/Basics
    Replies: 15
    Last Post: 01-22-2006, 03:55 PM
  6. How to count how many cells a linked cell group occupies
    By Kanaski79 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 09-23-2005, 04:05 PM
  7. Genarating count of unique words in a cell or cells
    By Hari in forum Excel Programming / VBA / Macros
    Replies: 23
    Last Post: 01-28-2005, 03:06 AM

Tags for this Thread

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