Count Cells that Contain Specific Text in Excel & Google Sheets - Automate Excel (2024)

In this tutorial, we will demonstrate how to count cells that contain specific text in Excel and Google Sheets.

Count Cells that Contain Specific Text in Excel & Google Sheets - Automate Excel (3)

COUNTIF Function

The COUNTIF Function counts cells that meet a criteria. We can use the COUNTIF Function to count the number of cells that contain specific text by using asterisk wildcards.

Asterisk wildcards represent any number of any characters. By adding them before and after our text, we can count the number of cells where the text is found anywhere within the cell.

General Formula:

=COUNTIF(Range, "*Text*")

Example Formula:

=COUNTIF(B3:B12, "*Hodge*")

Count Cells that Contain Specific Text in Excel & Google Sheets - Automate Excel (4)

By putting the last name “Hodge” inside of the asterisks, the COUNTIF Functions calculates all string values within the range that contain the name “Hodge”.

To demonstrate another example using the data set above, let’s say we wanted to find all the values in the range that contained the letters “lynn”.

We will use the following formula:

=COUNTIF(B3:B12, "*lynn*")

Count Cells that Contain Specific Text in Excel & Google Sheets - Automate Excel (5)

We end up with two results in this case as A5 and A6 being Ashlynn Gaines and Kaitlynn Moyer as both have the letters “lynn” in their names.

Please note that the asterisk symbols are located inside of the quotation marks.

Count Cells that Contain Specific Text in Google Sheets

The formula works exactly the same in Google Sheets as in Excel.

Count Cells that Contain Specific Text in Excel & Google Sheets - Automate Excel (6)

Count Cells that Contain Specific Text in Excel & Google Sheets - Automate Excel (2024)

FAQs

Count Cells that Contain Specific Text in Excel & Google Sheets - Automate Excel? ›

For example, if you want to count the number of cells in the range A1:A10 that contain the text "apple", you would enter the formula "=COUNTIF(A1:A10, "apple")" into a cell.

How to get Google Sheets to count cells with specific text? ›

For example, if you want to count the number of cells in the range A1:A10 that contain the text "apple", you would enter the formula "=COUNTIF(A1:A10, "apple")" into a cell.

Can Excel automatically count cells with text? ›

=COUNTIF (range,"text")You can use this function to count cells with specific text. This can help ensure that you don't overuse a word or make sure you've accounted for all the supplies you need for coffee or other subcategories. You may also use this function for analysis methods.

What is the formula in Excel to count cells with specific text from another sheet? ›

COUNTIF supports named ranges in a formula (such as =COUNTIF(fruit,">=32")-COUNTIF(fruit,">85"). The named range can be in the current worksheet, another worksheet in the same workbook, or from a different workbook. To reference from another workbook, that second workbook also must be open.

What is the formula to count if a cell contains specific text in Excel? ›

Use the COUNTIF function in Excel to count the occurrences of a specific text string in a column. Enter the formula "=COUNTIF(range, "text")" in a cell for the result. Replace "range" with the column range to search (for example, A1:A10) and "text" with the specific text string to count.

How do I find cells containing specific text in Google Sheets? ›

Check If Cell Contains Specific Text in Google Sheets Using IF+SEARCH
  1. Step 1: Identify the string and where to search. ‍ ...
  2. Step 2: Add the function =IFERROR(IF(SEARCH(string, range), value_if_true), value_if_false) ‍ ...
  3. Step 3: Check output. ‍

How do you count the number of cells with unique text in Google Sheets? ›

The syntax is simple: =COUNTUNIQUE(range), where “range” refers to the cell range containing the values to count.

How do you count if a cell contains partial text? ›

To check if a cell includes a particular piece of partial text, use the Excel formula below: =IF(COUNTIF(A1,*abc*),Yes,No). In this example, cell A1 will return a Yes if the string abc appears anywhere in the cell, and a No otherwise.

How do I auto detect text in Excel? ›

Turn automatic completion of cell entries on or off
  1. Click File > Options.
  2. Click Advanced, and then under Editing options, select or clear the Enable AutoComplete for cell values check box to turn this option on or off.

How to use countifs in Google Sheets? ›

The COUNTIFS function is a premade function in Google Sheets, which counts cells in a range based on one or more true or false condition. It is typed =COUNTIFS : =COUNTIFS(criteria_range1, criterion1, [criteria_range2, ...], [criterion2, ...])

How do you count if a cell contains specific text in Google Sheets? ›

Count number of Cells that Contain a Portion of a String
  1. Step 1: Identify the text and range. ‍ ...
  2. Step 2: Select the cell, then add the formula with the format =COUNTIF(range,”text”) Google Sheets count cells that contain a string portion.

How do you total if a cell contains specific text in Excel? ›

If you want, you can apply the criteria to one range and sum the corresponding values in a different range. For example, the formula =SUMIF(B2:B5, "John", C2:C5) sums only the values in the range C2:C5, where the corresponding cells in the range B2:B5 equal "John."

How to count number of cells with specific text based on another cell? ›

COUNTIF Function
  1. Select a cell.
  2. Type =COUNTIF.
  3. Double click the COUNTIF command.
  4. Select a range.
  5. Type ,
  6. Select a cell (the criteria, the value that you want to count)
  7. Hit enter.

How do I sum cells with specific text in Google Sheets? ›

How to use SUMIF
  1. Select the range of cells to be summed up. Use your mouse to drag and highlight (or type out) the alphanumeric range of cells that you'd like to sum up based on your criterion. ...
  2. Add the criterion. ...
  3. Highlight the range of cells to be added up based on the criterion. ...
  4. Press enter to sum up.
Nov 29, 2023

How do I count specific words in Google Docs? ›

Counting Words in Selected Text
  1. Highlight the text you want to get a word count for by left clicking the mouse and dragging the cursor. The text should appear inside a shaded box if you've selected it correctly. ...
  2. Click on the Tools tab at the top of the page and select Word count from the drop-down menu.

Top Articles
Latest Posts
Article information

Author: Delena Feil

Last Updated:

Views: 5551

Rating: 4.4 / 5 (65 voted)

Reviews: 80% of readers found this page helpful

Author information

Name: Delena Feil

Birthday: 1998-08-29

Address: 747 Lubowitz Run, Sidmouth, HI 90646-5543

Phone: +99513241752844

Job: Design Supervisor

Hobby: Digital arts, Lacemaking, Air sports, Running, Scouting, Shooting, Puzzles

Introduction: My name is Delena Feil, I am a clean, splendid, calm, fancy, jolly, bright, faithful person who loves writing and wants to share my knowledge and understanding with you.