+ Reply to Thread
Results 1 to 7 of 7

Count specific/part of a text in a cell

  1. #1
    Registered User
    Join Date
    02-01-2012
    Location
    New York
    MS-Off Ver
    Excel 2003
    Posts
    65

    Count specific/part of a text in a cell

    Is there a way to count part of a text in a cell. Say I had a column with a different sentence in each row. Is it possible for me to use a formula to find out how many times a "the" appears anywhere in the column; or is it possible to find out how many times the string of text "ch. Ab" appears; or even the times that the combination "ing" appears?

    Also on a somewhat unrelated note; I know that you can add text together but is there a way to split it apart using a formula. Say I had Surname, Firstname and I wanted to put Surname in a cell and Firstname in a different cell?

    Any help would be greatly appreciated, Thanks.

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,852

    Re: Count specific/part of a text in a cell

    With your sentences in column A, use this to count "the":

    =COUNTIF(A:A,"*"&"the"&"*")

    or you could put "the" in a cell somewhere (B1 - without the quotes), and the formula would become:

    =COUNTIF(A:A,"*"&B1&"*")

    then you could put any string in B1. The asterisk is a wildcard character, i.e. any number of characters. This might mis-count - e.g. it will count "Theatre", so you might want to put spaces around the word " the ".

    Hope this helps.

    Pete

  3. #3
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Count specific/part of a text in a cell

    Is it possible for me to use a formula to find out how many times a "the" appears anywhere in the column
    Below formula will check the text "the" in column A:-

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Now you can customize this further.. thanks.
    Regards,
    DILIPandey

    <click on below 'star' if this helps>
    DILIPandey, Excel rMVP
    +919810929744 (India), +971528225509 (Dubai), [email protected]

  4. #4
    Registered User
    Join Date
    02-01-2012
    Location
    New York
    MS-Off Ver
    Excel 2003
    Posts
    65

    Re: Count specific/part of a text in a cell

    Thanks guys! They both work great. Pete_UK's is simpler so I think I will use it for what I need right now but dilipandey's seems to be a bit more powerful if I have more complex applications later. I appreciate the help.

  5. #5
    Registered User
    Join Date
    02-01-2012
    Location
    New York
    MS-Off Ver
    Excel 2003
    Posts
    65

    Re: Count specific/part of a text in a cell

    Is there a way to count how many times both "the" and "ing" show up in the same sentence? Just the times that they BOTH show up and they aren't necessarily right next to eachother in the sentence. Thanks

  6. #6
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,852

    Re: Count specific/part of a text in a cell

    You can do this:

    =COUNTIFS(A:A,"*the*",A:A,"*ing*")

    or put the words in cells and refer to them:

    =COUNTIFS(A:A,"*"&B1&"*",A:A,"*"&C1&"*")

    COUNTIFS allows you to set up multiple conditions (ANDed together), whereas COUNTIF is for a single condition.

    Hope this helps.

    Pete

  7. #7
    Registered User
    Join Date
    02-01-2012
    Location
    New York
    MS-Off Ver
    Excel 2003
    Posts
    65

    Re: Count specific/part of a text in a cell

    Thanks, again it works great. I actually tried putting an AND formula in there and it didn't work. This is much easier anyways

+ 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