Google Sheets – Count cells containing specific text

If you’re using Google Sheets and you want to count the occurrences of a certain letter or word, there’s a pretty easy function that you can use.

Looking for a word and only that word

In this first set of data in the image above and also in this linked spreadsheet, we will be counting any cells that contain the word “Yellow” and only that word. To count the occurrences of the word yellow in the range B2 to B9 you can use the count COUNTIF function as such: =COUNTIF(B2:B9,"yellow"). It performs a conditional count. In this case, only if the cell or ranges of cells is equal to Yellow. Yellow is not case-sensitive so this is going to pick up three instances even though B7 is not capitalized. If the COUNTIF technique is doing everything you need, then you’re done and there is no need to try anything more involved.

Looking for a word occurring anywhere a cell

COUNTIF with wildcard
COUNTIF with wildcard

Looking at this second set of data, things will get a little bit more complicated. We are looking for a certain word that occurs anywhere in any of these cells. First, you want to use COUNTIF again and give it a range =COUNTIF(C2:C9, "*Yellow*"). For this example, the range will be C2 to C9. If it has the word yellow and anything before which is what the asterisk means, and anything after it which is the second asterisk, then it should be counted. It just has to have yellow in some part of it. Anything can be nothing so it can start or end with yellow too. This function is also counting 3 because of the yellow plane, the yellow car, and the little yellow boat.


The COUNTIF function is not case-sensitive. To count cells with specific capitalization, follow the second example in this tutorial.

Using a plugin

As an alternative to the options above, you may want a plugin to do the heavy lifting for you. I like to use a plugin called Power Tools. This will give you a menu option with, among other things, advanced Find and Replace features. This will give you a list of all the occurrences of a word in your spreadsheet, but it won’t give you a count of them. Depending on the size of the spreadsheet, this may be the preferable option.

The Find and Replace Menu
Find and Replace Menu

I hope that was helpful and now you know the formula for counting any occurrences of any word that you’re looking for.

 Live examples in Sheets

Go to this spreadsheet for examples counting specific text that you can study and use anywhere you would like.

Disclosure: This is an independently owned website that sometimes receives compensation from the company's mentioned products. Prolific Oaktree tests each product, and any opinions expressed here are our own.

0 thoughts on “Google Sheets – Count cells containing specific text

  • How do you do this for the same work in multiple sheets (or tabs) within a sheet?

    Say, sheet 1, sheet 2 and sheet 3 all have the same list of items in the same columns in each sheet. How would I gather a count of that number?

  • How do you go one step more and add find all the February’s and then count function?
    Right now I have:

    =COUNTIF(‘Form Responses”!K2:K900,”Average”)

    But I want to find February’s in Form Responses E2:E900

  • How do you do this if one word contains another word in it?
    For example, say I want to count instances of both “Alex” and “Alexandra”. How do I format it so that all instances of “Alexandra” don’t get counted as instances of “Alex”?

    • What you could do is =countif(A:A;”*Alex*”)-countif(A:A;”*Alexandra*”)
      That way every Alex that is counted but is Alexandra is subtracted and you leave only Alex

  • Thanks for all the information. I have been trying to use this formula, but for some reason its not working for me. I would love for the formula to count how many times do I have the letter “P” in the column.

  • if you have list with some things repeated with number in the adjacent row and you want to add the total for example

    a 4
    b 3
    a 2
    c 7
    b 1

    and you want to get the total for a (6) for b (4) and for c (7)

  • 1. What if i want to count the instances of the combination where column B shows “yellow” and column C shows anything more than 1?
    2. Furthermore, in those instances counted in question 1., how do i add up the numbers shown on column C? For example if only C4, C6, C7 show a number bigger than one, i.e 2, 5, 2 accordingly (and are on rows where column B is “yellow”), the sum of those value? I.e 9?
    Hope this is clear. Thanks 🙂

  • Hey there! Thanks for the article.

    I am trying to build an automated sheet for my online store to keep track of my stock & notify my manufacturer automatically when the runway for a specific item falls below a certain number of days.

    For this, I would pull data from my shopify store with Zapier.

    Using historical data of the last 7 (or 30) days, I would estimate

    a) the average # of “item1” per order (also item2, item3, …)
    b) average # of orders per day

    Coupled with the absolute quantity for each item in my warehouse, I will know

    –> how many days until I am sold out of a given item


    –> send automated emails to my manufacturer once the runway of an item falls below a defined threshold (in my case the lead time to get new product, e.g. 30 days), also factoring in +/- accuracy error margins

    –> result would look like “item1 will be sold out in 38-45 days”

    For this, I need to count the number of times a specific word appears in the item’s title (as pulled directly from shopify)

    Challenge: I sell items in bundles, which do not contain every item’s name.

    I sell single origin cacao, the product titles all contain the country of origin, e.g. “mexico”.
    My best selling product though is the “explorer’s box” which contains 3 of our bestselling strains (“mexico”, “venezuela”, “madagascar”).

    So what I need to do in order to make the formula =COUNTIF(A2, “*mexico*”) work is to also look for the word “*explorer*” in the item’s title.

    If any one of those is true, the output for my column “#of mexico sold” should be 1 (because in every “explorer’s box”, there is one “mexico”).

    How can I include this OR function? I have the feeling that the operator “OR” in spreadsheets is not what I am looking for…

    Thanks for your help!

  • Is there a way to count how many times a word is used in a sheet? I used =countif($B$2:$B$83,”*who*”) to find how many cells contained the word “who” within it. However, I want to count how many times “who” was used, because it can be used within a cell multiple times.

    Thank you!

  • How do I sort and count a column that is filled with 10 digit numbers. I want to count it by the end of every numbers.

    I want to count them by the last 2 digits.

    Please I need your help

  • how would i count the # of cells that contained one of several text strings but only count them once? for example, i’d like to count the number of cells with “blue” or “green” but only wanted a cell labeled “blue green” to count once

  • How would I count text within two different columns? For example, I’m trying to count how many customers said yes or no (column A) from Angi Business Center (column B). Not sure if I’m explaining this correctly, but any help would be appreciated.

  • Theis Svendsen says:

    Thanks for this!
    I’m trying to take it a step further, but can’t seem to get it to work.

    Case is:

    Column B contain country names. Column C contain either “xxxxx W” or “xxxxx L”.
    I’ve made a table where I’d like the output of W/L counts of the specific country (into seperate cells of course).

    How would I go about this?

  • Hey PO!
    Can you help?
    If I had a sheet which had two columns, that have words containing FLAG and FLAGGED, and I wanted to and up the total number of times these words both appear in total in a sheet, how can I do that please?
    Thank you 🙂

Leave a Reply