Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Google Sheets: How to Count How Many Times a Word Appears

· 6 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

To count how many times a specific word appears in a range of cells in Google Sheets, use the =COUNTIF(range, "word") formula. This function scans a selected area and returns the total number of cells that contain exactly that word. If you need to count a word that is part of a larger sentence within a cell, you must use wildcards, such as =COUNTIF(range, "*word*").

What You'll Need

  • A Google account with access to Google Sheets.
  • A dataset containing the text or words you wish to analyze.
  • Basic familiarity with selecting cell ranges (e.g., A1:A100).

Step-by-Step

  1. Prepare Your Data: Open your Google Sheet and ensure the words you want to count are organized in a column or row. For this example, assume your data is in column A, from cell A1 to A20.
  2. Select the Output Cell: Click on the empty cell where you want the final count to appear. This is usually a cell to the right of your data or at the bottom of the column.
  3. Enter the Basic Formula: Type =COUNTIF( into the cell. The COUNTIF function requires two arguments: the range of cells to search and the criterion (the word) to look for.
  4. Define the Range: While the cursor is inside the parentheses, highlight the cells you want to search with your mouse, or type the range manually (e.g., A1:A20). Then, type a comma to move to the next argument.
  5. Specify the Word: Type the word you are looking for inside double quotation marks. For example, if you are counting the word "Completed", your formula should look like =COUNTIF(A1:A20, "Completed").
  6. Execute the Formula: Press Enter. Google Sheets will instantly display the number of cells in that range that match your word exactly.
  7. Counting Partial Matches (Wildcards): If your cells contain full sentences and you want to count every cell that contains the word anywhere in the text, use asterisks. The asterisk acts as a placeholder for any number of characters. Enter =COUNTIF(A1:A20, "*Completed*"). This will count a cell whether it says "Completed", "Task Completed", or "Completed the project".
  8. Using a Cell Reference for the Word: Instead of typing the word into the formula, you can point the formula to another cell. If you type the word "Completed" into cell B1, change your formula to =COUNTIF(A1:A20, B1). This allows you to change the word you are counting simply by typing a new word in B1 without editing the formula.
  9. Counting Partial Matches with Cell References: To combine wildcards with a cell reference, use the ampersand symbol to join them. The formula would be =COUNTIF(A1:A20, "*" & B1 & "*"). This tells Google Sheets to look for whatever text is in B1, surrounded by any other characters.

Common Mistakes

One of the most frequent errors is forgetting the double quotation marks around the word in the criterion section of the formula. In Google Sheets, any text string used inside a formula must be wrapped in quotes; otherwise, the software interprets the word as a named range or a function, resulting in a #NAME? error.

Another common mistake is confusing a "cell count" with a "word count." The COUNTIF function counts how many cells contain the word. If a single cell contains the word "Apple" three times (e.g., "Apple, Apple, Apple"), COUNTIF will only count that cell once. If your goal is to count every single occurrence of a word across an entire sheet, regardless of how many times it appears in one cell, you will need a more complex formula involving SUBSTITUTE and LEN.

Users also frequently overlook leading or trailing spaces. If a cell contains "Completed " (with a space at the end), the formula =COUNTIF(A1:A20, "Completed") will ignore it because it is not an exact match. This is a data cleanliness issue that often leads to undercounting.

Tips

To handle the issue of extra spaces mentioned above, you can wrap your range in a TRIM function using an ARRAYFORMULA. This removes all leading and trailing spaces before the count happens. The formula would look like =ARRAYFORMULA(COUNTIF(TRIM(A1:A20), "Completed")).

If you need to count multiple different words at once, you can use the SUM function combined with an array of criteria. For example, to count how many cells contain either "Completed" or "In Progress", use =SUM(COUNTIF(A1:A20, {"Completed", "In Progress"})). Note that the curly brackets create an array that allows COUNTIF to look for both terms simultaneously.

For those who need case-insensitive counting, COUNTIF is naturally case-insensitive. It will treat "COMPLETED", "completed", and "Completed" as the same word. If you specifically need a case-sensitive count, you must use the SUMPRODUCT function combined with EXACT, such as =SUMPRODUCT(--EXACT("Completed", A1:A20)).

Troubleshooting

If your formula returns 0 when you know the word exists, first check for hidden spaces. Double-click a cell that should have been counted and see if there is a space after the word. If there is, use the wildcard method "*word*" or the TRIM function to resolve the discrepancy.

If you see a #VALUE! error, check your syntax. Ensure that you have used a comma to separate the range and the criterion. Depending on your regional settings (some European countries), Google Sheets may use a semicolon (;) instead of a comma (,) to separate arguments in a formula. If the comma fails, try =COUNTIF(A1:A20; "Completed").

If you are using a cell reference (like B1) and the count is not updating, ensure that the cell you are referencing does not have a leading space or a hidden character. You can test this by typing =LEN(B1); if the word has 9 letters but the length is 10, there is a hidden character causing the match to fail.

If the formula is returning a #REF! error, it usually means the range you specified no longer exists. This happens if you deleted the columns or rows that the formula was pointing to. You will need to re-select the range to fix this.

Frequently Asked Questions

Can I count words across multiple sheets?

The standard COUNTIF function only works on a single sheet. To count words across multiple tabs, you must add multiple COUNTIF functions together, such as =COUNTIF(Sheet1!A1:A20, "Word") + COUNTIF(Sheet2!A1:A20, "Word").

How do I count all words that start with a specific letter?

You can use a wildcard at the end of your criterion. For example, to count all words starting with "App" (like Apple, Application, Apply), use =COUNTIF(A1:A20, "App*").

Is there a way to count words that are NOT a specific word?

Yes, you can use the "not equal to" operator, which is written as <>. To count every cell that does not contain the word "Completed", use =COUNTIF(A1:A20, "<>Completed").

Can I count words based on two different conditions?

For multiple conditions (e.g., count cells that say "Completed" AND are in the "North" region), use the COUNTIFS function (with an 'S' at the end). The syntax is =COUNTIFS(range1, criterion1, range2, criterion2).

How do I count every single instance of a word in a cell?

Since COUNTIF only counts cells, use this formula to count every occurrence: =(LEN(A1)-LEN(SUBSTITUTE(A1, "word", ""))) / LEN("word"). This calculates the difference in length between the original text and the text with the word removed, then divides by the length of the word itself.