**How to Count Text in Excel**

- If you want to learn how to count text in Excel, you need to use function COUNTIF with the criteria defined using wildcard *, with the formula: =COUNTIF(range;”*”).
- Text Cells can be easily found in Excel using COUNTIF or COUNTIFS functions.

How do you create a text formula in Excel?

- According to Microsoft
**Excel**,**Text**Function is defined as “A**formula**that converts a value to**text**in a specific number format.”. The Syntax of**Text****Formula**is as follows: =**TEXT**(value, format_**text**) Here, ‘value’ specifies the number that you wish to convert to**text**.

Contents

- 1 How do I count text cells in Excel?
- 2 How do I count names in Excel?
- 3 How do I count partial text in Excel?
- 4 How do I count multiple text values in Excel?
- 5 How do I count cells with text in sheets?
- 6 How do I count cells with text but not formulas?
- 7 How do I count a range of values in Excel?
- 8 COUNTIF function
- 9 Examples
- 10 Common Problems
- 11 Best practices
- 12 Need more help?
- 13 See also
- 14 Count cells that contain text
- 15 Excel Formula Training
- 16 Download 100+ Important Excel Functions
- 17 Excel video training
- 18 How to Count Cells With Text in Excel
- 19 How to Count Cells With Text in Excel on a Windows PC
- 20 How to Count Cells With Text in Excel on a Mac
- 21 How to Count Cells With Text in Excel 365
- 22 How to Count Cells With Text in Excel on the iPhone App
- 23 How to Count Cells With Text in Excel on the Android App
- 24 How to Count Cells in Excel That Have Specific Text
- 25 How to Count Cells With Duplicate Text in Excel
- 26 How to Count Cells With Color Text in Excel
- 27 Finding the Cells With Text
- 28 Excel formulas to count cells with text: any, specific or filtered cells
- 29 How to count number of cells with text in Excel
- 30 Count cells with text excluding spaces and empty strings
- 31 How to count cells with certain text in Excel
- 32 How to count filtered cells with text in Excel
- 33 You may also be interested in
- 34 Count Cells that Contain Text in Excel
- 35 How to count if cell contains text or part of text in Excel?
- 35.0.1 Count if cell contains text or part of text with the COUNTIF function
- 35.0.2 Only several clicks can count if cell contains text or part of text in Excel:
- 35.0.3 Count cells contain text with the COUNTIF function
- 35.0.4 Count if cell contains text or part of text with Kutools for Excel
- 35.0.5 Related articles
- 35.0.6 Demo: Count if cell contains text or part of text with Kutools for Excel

- 36 Count Specific Text in a Cell
- 37 Count Text String in Cell
- 38 Count Specific Text Items in Cell
- 39 DownloadSample File
- 40 More Function Tutorials

## How do I count text cells in Excel?

How to Count Cells With Text in Excel 365

- Open the “Excel spreadsheet” you wish to examine.
- Click on an “empty cell” to type the formula.
- In the empty cell, type: “ =COUNTIF (range, criteria).” This formula counts the number of cells with text in them from within your specified cell range.

## How do I count names in Excel?

Ways to count cells in a range of data

- Select the cell where you want the result to appear.
- On the Formulas tab, click More Functions, point to Statistical, and then click one of the following functions: COUNTA: To count cells that are not empty.
- Select the range of cells that you want, and then press RETURN.

## How do I count partial text in Excel?

Select a blank cell you will place the counting result at, type the formula =COUNTIF(A1:A16,”*Anne*”) (A1:A16 is the range you will count cells, and Anne is the certain partial string) into it, and press the Enter key. And then it counts out the total number of cells containing the partial string.

## How do I count multiple text values in Excel?

To get a count of values between two values, we need to use multiple criteria in the COUNTIF function. You can also use a combination of cells references and operators (where the operator is entered directly in the formula). When you combine an operator and a cell reference, the operator is always in double quotes.

## How do I count cells with text in sheets?

COUNTA Method

- Select a blank cell and type the =COUNTA function including the range of cells that you want to count. For example, we used =COUNTA(A2:A11).
- Just hit enter, and the COUNTA function will automatically count the cells that are not blank.
- You now have the total number of cells that have values in it!

## How do I count cells with text but not formulas?

To count the number of cells that do not contain certain text, you can use the COUNTIF function. In the generic form of the formula (above), rng is a range of cells, txt represents the text that cells should not contain, and “*” is a wildcard matching any number of characters.

## How do I count a range of values in Excel?

Use AutoSum by selecting a range of cells that contains at least one numeric value. Then on the Formulas tab, click AutoSum > Count Numbers.

## COUNTIF function

For example, to count the number of times a specific city occurs in a customer list, you may use COUNTIF, one of the statistical functions, to count the number of cells that fit the criteria. COUNTIF is defined as follows in its most basic form:

- =COUNTIF(Which part of the world do you want to look at? , What exactly are you looking for? )

As an illustration: COUNTIFICATION (range, criteria)

Argument name | Description |
---|---|

range(required) | The group of cells you want to count.Rangecan contain numbers, arrays, a named range, or references that contain numbers. Blank and text values are ignored.Learn how toselect ranges in a worksheet. |

criteria(required) | A number, expression, cell reference, or text string that determines which cells will be counted.For example, you can use a number like 32, a comparison like ” 32″, a cell like B4, or a word like “apples”.COUNTIF uses only a single criteria. UseCOUNTIFSif you want to use multiple criteria. |

## Examples

Copy the data from the table below and paste it into cell A1 of a new worksheet to utilize these examples in Excel.

Data | Data |
---|---|

apples | 32 |

oranges | 54 |

peaches | 75 |

apples | 86 |

Formula | Description |

=COUNTIF(A2:A5,”apples”) | Counts the number of cells with apples in cells A2 through A5. The result is 2. |

=COUNTIF(A2:A5,A4) | Counts the number of cells with peaches (the value in A4) in cells A2 through A5. The result is 1. |

=COUNTIF(A2:A5,A2)+COUNTIF(A2:A5,A3) | Counts the number of apples (the value in A2), and oranges (the value in A3) in cells A2 through A5. The result is 3. This formula uses COUNTIF twice to specify multiple criteria, one criteria per expression. You could also use theCOUNTIFSfunction. |

=COUNTIF(B2:B5,” 55″) | Counts the number of cells with a value greater than 55 in cells B2 through B5. The result is 2. |

=COUNTIF(B2:B5,”” B4) | Counts the number of cells with a value not equal to 75 in cells B2 through B5. The ampersand () merges the comparison operator for not equal to () and the value in B4 to read =COUNTIF(B2:B5,”75″). The result is 3. |

=COUNTIF(B2:B5,” =32″)-COUNTIF(B2:B5,” 85″) | Counts the number of cells with a value greater than () or equal to (=) 32 and less than () or equal to (=) 85 in cells B2 through B5. The result is 3. |

=COUNTIF(A2:A5,”*”) | Counts the number of cells containing any text in cells A2 through A5. The asterisk (*) is used as the wildcard character to match any character. The result is 4. |

=COUNTIF(A2:A5,”?es”) | Counts the number of cells that have exactly 7 characters, and end with the letters “es” in cells A2 through A5. The question mark (?) is used as the wildcard character to match individual characters. The result is 2. |

## Common Problems

Problem | What went wrong |
---|---|

Wrong value returned for long strings. | The COUNTIF function returns incorrect results when you use it to match strings longer than 255 characters.To match strings longer than 255 characters, use theCONCATENATE functionor the concatenate operator. For example, =COUNTIF(A2:A5,”long string” “another long string”). |

No value returned when you expect a value. | Be sure to enclose thecriteriaargument in quotes. |

A COUNTIF formula receives aVALUE! error when referring to another worksheet. | This error occurs when the formula that contains the function refers to cells or a range in a closed workbook and the cells are calculated. For this feature to work, the other workbook must be open. |

## Best practices

Do this | Why |
---|---|

Be aware that COUNTIF ignores upper and lower case in text strings. | Criteriaaren’t case sensitive. In other words, the string “apples” and the string “APPLES” will match the same cells. |

Use wildcard characters. | Wildcard characters —the question mark (?) and asterisk (*)—can be used incriteria. A question mark matches any single character. An asterisk matches any sequence of characters. If you want to find an actual question mark or asterisk, type a tilde (~) in front of the character.For example, =COUNTIF(A2:A5,”apple?”) will count all instances of “apple” with a last letter that could vary. |

Make sure your data doesn’t contain erroneous characters. | When counting text values, make sure the data doesn’t contain leading spaces, trailing spaces, inconsistent use of straight and curly quotation marks, or nonprinting characters. In these cases, COUNTIF might return an unexpected value.Try using theCLEAN functionor theTRIM function. |

For convenience, use named ranges | 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. |

Keep in mind that the COUNTIF function will not count cells based on the color of the cell background or font. Nevertheless, Excel offers User-Defined Functions (UDFs) that are implemented using the Microsoft Visual Basic for Applications (VBA) operations on cells that are based on the background or font color of the cell. Here is an example of how to count the number of cells that have a given cell color by using Visual Basic for Applications.

## Need more help?

You may always ask a question to an expert in theExcel Tech Community or receive help from other members of theAnswers community.

## See also

The COUNTA function may be used to count the number of cells that are not blank. The COUNTIFS function may be used to count cells based on a variety of criteria. View a video demonstration of how to use the COUNTIFS function in Excel. The SUMIF function adds just the values that satisfy a specific set of requirements; otherwise, it is useless. The SUMIFS function only adds items that fulfill many conditions; otherwise, it does not add anything. IFS is an acronym for Information and Financial Services (Microsoft 365, Excel 2016 and later) The TRIM function may be used to eliminate leading and trailing spaces from cells in a spreadsheet.

An overview of the formulae in Microsoft Excel How to prevent formulae that don’t work Formula mistakes should be identified and corrected.

Excel has a number of features (alphabetical) Excel has a number of features (by Category) For rapid data analysis, SUMIF, COUNTIF, and other similar functions are used (free preview)

## Count cells that contain text

SynopsisThe COUNTIF function and the wildcard (*) are used to count the number of cells in a range that contain text (as opposed to integers, errors or blanks) when the range contains text. Where data is thenamed rangeB5:B15, the formula in cell H5 reads:wheredatais thenamed rangeB5:B15. Take note that this algorithm counts the number of cells that contain any text. Instead, use this formula to count the number of cells that contain certain text. Explanation The purpose in this example is to count the number of cells in a range that contain any type of text.

The solution makes use of the COUNTIF function, which counts the number of cells that fit the conditions that have been provided by the user.

H5 has the following formula:=COUNTIF(data,”*”)/ all text values The following formula in H6 counts the number of cells in the data that do not include text: Non-text values are represented using the function =COUNTIF(data,”*”). This formula makes use of the logical operator not equal to (). Notes:

- In this case, the logical values TRUE and FALSE are not considered text. Unless they are submitted as text, numbers are not tallied by the “*” symbol. Empty cells are not included in the text count.

### COUNTIFS option

If you need to apply more specific criteria, you may use the COUNTIFs function, which allows you to provide several conditions. Consider the following example: To count cells that include text but omit cells that simply have a space character, you may use a formula such as this:

### SUMPRODUCT option

You can also use theSUMPRODUCT function in conjunction with theISTEXT function to count text, as seen below: ISTEXT produces TRUE and FALSE results, which are converted into 1s and 0s by using the double negative (-). After that, SUMPRODUCT adds up the results. Formulas that are related The COUNTIF function counts the number of cells in a range that satisfy certain conditions. For example, if you want to count the number of cells in a range that include the letter “a,” you may use the following syntax: = COUNTIF (range, “a”).

- To be able to.
- Counting cells that contain dates, numbers, and text may be accomplished with the COUNTIF function.
- Whenever a cell includes a text value, the Excel ISTEXT function returns TRUE; otherwise, it returns FALSE if the cell contains any other value.
- The SUMPRODUCT function in Microsoft Excel multiplies ranges or arrays together and provides the total of the products produced.
- The COUNTIFS function in Microsoft Excel returns the number of cells that fulfill one or more conditions.
- The logical operators (,) are supported by COUNTIFS.

## Excel Formula Training

Excel’s formulas are essential for getting things done in the program. The skills you’ll get in this rapid course include how to modify text using formulae, deal with dates and times, lookup values with VLOOKUP and INDEXMATCH, count and sum with criteria, dynamically rank values, and construct dynamic ranges, among other things. You’ll also learn how to diagnose issues, track down faults, and resolve issues. You will get immediate access. Details may be found here.

## Download 100+ Important Excel Functions

Get over 100 Excel functions you should be familiar with in one convenient PDF.

## Excel video training

It’s short, sweet, and to the point. More information may be found here.

## How to Count Cells With Text in Excel

Excel spreadsheets are a convenient method to store and analyze large amounts of data. In most cases, spreadsheets are composed of cells that include a combination of numbers and text. It is necessary to distinguish the cells with text in order to better grasp your data.

This article demonstrates how to choose a cell range and then use the “COUNTIF” function to count the number of cells that contain text in the selected range. In addition, you may learn how to discover particular, duplicate, and colored text in your spreadsheet by following the instructions.

## How to Count Cells With Text in Excel on a Windows PC

On a Windows machine, you may count the number of text-containing cells in your spreadsheet by doing the following steps:

- To put the formula into your spreadsheet, choose a “empty cell” on the page. To count the number of cells containing text within a given cell range, type or paste the function=”=COUNTIF (range, criteria)” without quotes into your spreadsheet. Enter the cell range you wish to check in the “range” field. Fill in the blanks in the first and last cells, separating them with a colon. For example, to count the cells from A2 to A9, you would put “A2:A9.” For “criteria,” you would use “”*”” with quotes around it. This function counts the number of cells that contain text within a defined range of cell values. In its entirety, the formula should read something like this: “=COUNTIF A2:A9, “*”).”
- Now, press the “enter” key to put the formula into action. The result will be shown in the cell containing the formula.

## How to Count Cells With Text in Excel on a Mac

The procedures for counting the number of cells in your spreadsheet that include text on macOS are the same as those for Excel on Windows:

- Start by launching “Excel,” and then opening the spreadsheet you wish to examine. If the file has Excel set as its default software, you may simply “double-click” it to open it. To input the formula, choose a “empty cell” on your spreadsheet and press Enter. Make a note in the empty cell that the formula is “=COUNTIF (range, criteria).” When a cell has text in it, this formula counts the number of times it appears in the provided range. In the “range” field, enter the cell range that you want to examine. Enter the contents of the first and last cells, separated by a colon. In order to count cells B2 through B10, for example, you would type “B2:B10.” In the “criteria” section, type “”*”” without quotation marks. This counts the number of cells that have text inside the range that you specified into the text box. For example, the whole formula should look something like ” =COUNTIF (B2:B10, “*”).” ” =COUNTIF (B2:B10, “*”)”
- To put the formula into action, use the “enter” key on your keyboard. The result is displayed in the cell that was selected.

## How to Count Cells With Text in Excel 365

To count the number of cells in your spreadsheet that include text in Excel 365, you may use the same “COUNTIF” function that is available in Excel for Windows and macOS. Here’s how it’s done:

- Open the “Excel spreadsheet” that you want to look at in detail. To input the formula, click on a “empty cell” on the spreadsheet. Type the following in the empty cell: “=COUNTIF (range, criterion).” If you specify a cell range, this formula will count the number of cells that have text in them inside that range. To fill up the “range” section, enter the cell range that you wish to examine. Please fill out the first and last cells, which are separated by a colon. “C2:C1.” is a good example of how to count cells C2 through C11. To fill up the blanks for “criteria,” write or paste “”*”” in quotations. This counts the number of text-filled cells (within your spedified range) in the data set. Consider the following example: “=COUNTIF (C2:C11, “*”)” as your whole formula.
- Once you’ve finished, hit “enter” to put the formula into action. The result will be shown in the cell containing the formula.

## How to Count Cells With Text in Excel on the iPhone App

If you’re using the Excel app on your iPhone to count the number of cells that contain text in your spreadsheet, follow these instructions:

- Activate the “iPhone Excel Application.” To access your stored spreadsheets, tap on “Open,” then choose the specific”Excel file” to open it. If you want to enter the “COUNTIF” formula into a spreadsheet cell, you may either “double-tap” on an”empty cell” or “long-press” an”empty cell” and then select”Edit” from the pop-up menu. Make a note in the empty cell that the formula is “=COUNTIF (range, criterion).” This formula counts the number of cells containing text that are contained inside your specified cell range. In the “range” section, enter the “cell range” that you wish to count. Please fill out the first and last cells, which are separated by a colon. Enter “D2:D12” to count the cells from D2 to D12
- For the “criteria,” enter “”*”” with quotation marks around it. This counts the number of cells in the range that have text in them. In its entirety, the formula should look like this: “=COUNTIF (D2:D12, “*”).”
- Now, press “enter” to put the formula you just prepared into action. The result will be shown in the cell containing the formula.

## How to Count Cells With Text in Excel on the Android App

To count the number of cells in your spreadsheet that contain text by using the Android Excel app, perform the following steps:

- Start the “Android Excel application.” The spreadsheet you wish to view may be opened by touching on “Open” to see all of your stored spreadsheets, then tapping on the”desired file” to have the spreadsheet open automatically
- When you see a “empty cell,” double-tap it to input the “COUNTIF” formula. Alternatively, you may “long-press”an”empty cell,” then select”Edit”from the pop-up menu that appears
- Or “=COUNTIF (range, criterion)” should be entered in the empty cell without the quotation marks. When you use this formula, it counts the number of cells that have text in them inside a certain cell range. When you fill out the “range” portion of the formula, you should input the cell range that you want to count. Please fill out the first and last cells, which are separated by a colon. “E2:E12” indicates that cells E2 through E12 from a single column are being counted. In the “criteria” section of the formula, type “”*”” without the quotation marks. This counts the number of cells containing text in the provided range, which may include more than one row of information. Your whole formula should look something like this: “=COUNTIF (A2:E12, “*”)” or anything along those lines.
- Now press the “enter” key to put the formula into action. The result is displayed in the cell containing the formula.

## How to Count Cells in Excel That Have Specific Text

It is possible to count the number of cells that contain specified text strings, such as “Excel,” “John,” or John Meyers, by employing the function called “COUNTIF.” The formula is similar to counting cells with any type of text in them, but you adjust the “criteria” component of the formula to search for particular text instead of just counting cells. For example, in this sample, you’ll notice how many times the term “Excel” appears in a certain cell range:

- Open “Excel” on your device and the “designated file,” or just launch the “designated file” if your device is already configured to open Excel by default. To input the formula, click on a “empty cell” on the spreadsheet. “=COUNTIF (range, criterion)” should be typed without quotation marks in the empty cell. When you fill out the “range” portion of the formula, you should input the cell range that you want to count. Please fill out the first and last cells, which are separated by a colon. To count the cells from A2 to A20, type “A2:A20” without the quotation marks. In the “criteria” portion of the formula, enter “”Excel”” with quotation marks around the word. This function counts the number of cells in the provided range that include the word “Excel.” If your formula looks like this: “=COUNTIF (A2:A20, “Excel”),” then it is correct.

## How to Count Cells With Duplicate Text in Excel

In addition to measuring the number of cells containing text and particular text, you can also count the number of cells containing duplicate material. In the following example, we’re looking for students who have received duplicate grades. The following is how our spreadsheet is set up:

- Column A has a list of our pupils. A2 to A10
- Column B – displays each student’s grades (A, B, or C)
- Column D – lists the grades that are currently accessible
- A2 to A10
- D2 represents “As,” D3 represents “Bs,” and D4 represents “Cs.” Column E contains the number of students in each grade

### Count Cells With Duplicate Text Including First Instance

You may add the following formulae in each cell of your spreadsheet to count the number of cells that include instances of grade “A,” “B,” or “C” – including the first instance – of each letter grade. After that, you’ll get a total of how many duplicate grades there were, including the initial case stated in column “E.”

### Count Cells With Duplicate Text Excluding First Instance

You may insert the following formulae in each cell of your spreadsheet to count the number of cells that include occurrences of grade “A,” “B,” or “C” – including the first instance – of grade “A.” With the count for duplicate grades, which includes the initial incidence given in column “E,” you now have the total number of duplicate grades.

## How to Count Cells With Color Text in Excel

Excel does not have a formula for counting cells depending on the color of their text. If you want to get around this, filter the results first and then count them. Here’s how it’s done:

- Open the spreadsheet that you want to analyze
- And Using the right-click menu, choose a cell containing the text of the color you desire to count
- Choosing “Filter,” then “Filter by Specified Cell’s Font Color” will allow you to filter out cells that have the selected text color. After that, tell Excel to count the data in your data range. If your text is listed from cell B2 to B20, insert the following formula: ” =SUBTOTAL (B2: B20) “
- Otherwise, enter ” =SUBTOTAL (B2: B20) “

Following the pressing of the “Enter” key to apply the filter, Excel will only display the cells that have the specified color and conceal the other values. The “SUBTOTAL” function will omit the values in the concealed rows, resulting in a count that is limited to the color of the text that was picked as the background.

## Finding the Cells With Text

The Excel program performs an excellent job of storing and organizing your data, as well as making analysis easier. It is capable of handling both text and numbers. It has almost four hundred functionalities, one of which is the “COUNTIF” command. If you want to determine the total number of cells holding certain information, such as text, or the total number of occurrences of a given text, this function is quite handy for you.

Is it possible that you were able to figure out what you needed to know about your spreadsheet information? In general, how useful do you feel Excel to be? Please express your thoughts in the comments box below.

## Excel formulas to count cells with text: any, specific or filtered cells

In Excel, how can I count cells that include text? It is possible to count cells based on whether they contain any text, certain characters, or just filtered cells using a variety of formulae. In Excel 2019, 2016, 2013, and 2010, all of the formulae are functional. Initially, Excel spreadsheets were intended to be used solely for numerical calculations. However, we are increasingly using them to store and alter text as well. Do you want to know how many text-filled cells there are in your spreadsheet?

Which one should you choose to work with?

The formulae presented in this tutorial will help you to understand when to utilize each formula the most effectively.

## How to count number of cells with text in Excel

If you want to know how many cells in a particular range contain any text string or character, there are two fundamental formulae you may use.

### COUNTIF formula to count all cells with text

When attempting to determine the number of cells containing text in Excel, the COUNTIFfunction with an asterisk in the criteriaargument is the most straightforward and straightforward solution: COUNTIF(range, “*”) is a function that counts the number of items in a range. Asterisk (*) represents a wildcard that matches any sequence of characters, hence the formula counts any cells that contain any text.

### SUMPRODUCT formula to count cells with any text

Using the SUMPRODUCT and ISTEXT functions in conjunction, you may obtain the number of cells containing text in another manner. SUMPRODUCT(-ISTEXT(range)) OrSUMPRODUCT(ISTEXT(range)*1) Using the ISTEXT function, you may determine whether or not each cell in the provided range has any text characters. The method returns an array of TRUE values for cells that contain text and FALSE values for other cells. The double unary (-), also known as the multiplication operation, converts the values TRUE and FALSE into 1 and 0, respectively, resulting in an array of ones and zeros in the result.

Please review the following examples to acquire a better grasp of how these formulae work: Which values are counted and which are not

- Cells containing any text
- Characters who stand out
- Numbers that have been formatted as text
- Visually blank cells that include an empty string (“”), an apostrophe (‘), a space, or other nonprinting characters are known as visual blank cells.

- Numbers, dates, logical values of TRUE and FALSE, errors, and blank cells are all acceptable.

For example, one of the following formulae may be used to count the number of text cells in the range A2:A10, ignoring numbers, dates, logical values, errors, and blank cells: =COUNTIF(A2:A10, “*”) COUNTIF(A2:A10, “*” =SUMPRODUCT(-ISTEXT(A2:A10)) =SUMPRODUCT(ISTEXT(A2:A10)*1) The following screenshot illustrates the outcome:

## Count cells with text excluding spaces and empty strings

The formulae presented above count the number of cells that contain any text characters in each row and column. Some instances, however, may be misleading since certain cells may appear empty but may really include characters that are invisible to the human eye, such as empty strings, punctuation marks, spaces, and line breaks, among other things. Consequently, a visibly blank cell is included in the formula’s calculation, forcing the user to tear their hair out while trying to figure out why:) Using the COUNTIFSfunction with the “excluded” character in the second criterion will allow you to exclude blank cells that are “false positive” from the count.

If the target range contains any formula-driven data, some of the formulae may result in an empty string if the target range contains any formula-driven data (“”).

Because an empty string has no characters, it does not fit the criterion and is thus not included in the count.

An empty string (=””) appears in A9, and a space appears in A7, an apostrophe appears in A8, and an apostrophe appears in A9. Our algorithm eliminates all of those cells and produces a total number of text cells of 3:

## How to count cells with certain text in Excel

If you want to know how many cells contain a specific text or character, you can simply specify that text or character in the criteriaargument of the COUNTIF function. The examples that follow will help you understand the subtleties. If you want your text to match the example text exactly, type the entire text wrapped in quote marks: COUNTIFICATION (range, ” text “) To count cells with partialmatch, position the text between two asterisks, which represent any number of characters before and after the text: Place the text between two asterisks, which represent any number of characters before and after the text: COUNTIF(range, “* text *”) is a function that counts the number of items in a range.

For example, the following formula may be used to determine how many cells in the range A2:A7 contain the exact word “bananas”: =COUNTIF =COUNTIF (A2:A7, “bananas”) This formula may be used to count all cells that have the word “bananas” as part of their contents in any position: =COUNTIF(A2:A7, “*bananas*”) is a conditional expression.

- The COUNTIF function may be used to determine the number of cells that contain a specific text or character by simply passing the text or character as an argument to it in the criteriaargument. Explanations of the subtleties are provided in the following examples: Using quote marks around the whole sentence will ensure that the sample content is accurately replicated. COUNTIF – Count the number of times (range, ” text “) Place the text between two asterisks, which denote any number of characters before and after the text, in order to count cells with partial match: The function COUNTIF(range, “* text *”) counts the number of times a text string appears in a range. As an illustration, the following formula may be used to determine how many cells in the range A2:A7 contain the exact word “bananas”: CONSIDERATIONS =COUNTIF (A2:A7, “bananas”) You may use the following formula to count all cells that have the word “bananas” as part of their contents, regardless of their location: *bananas* = COUNTIF(A2:A7, “bananas*) You may make the formula more user-friendly by placing the criterion in a predefined cell, such as D2, and including the cell reference in the second argument: CONSIDERATIONS =COUNTIF (A2:A7, D2) In accordance with the information provided in D2, the formula can either completely or partially match the example text.

Due to the fact that the formula is case-insensitive, you need not worry about the letter case, which means that *bananas* will suffice. Instead, you may concatenate the cell reference with wildcard characters like as:=COUNTIF(A2:A7, “*” D2 “*”) to count cells that have a partial match. For additional details, read How to count cells containing a certain text in Excel for more information.

## How to count filtered cells with text in Excel

When using an Excel filter to display just the data that is relevant at a given time, it may be necessary to count the number of visible cells that include text. Unfortunately, there is no one-click solution for this activity, but the sample below will guide you through the process in an easy and comfortable manner. Assume you have a table similar to the one shown in the image below. Many problems occurred during the process of retrieving certain records from a bigger database that was accessed using a formula.

When all of the rows are displayed, the COUNTIF formula we’ve been using for counting cells with text works perfectly:=COUNTIF(A2:A10, “*”) And then you narrow down the list based on certain criteria, such as excluding products having a quantity larger than ten (for example).

This is what you must do in order to count filtered cells that include text:

- Make sure that all of the rows in your source table are displayed. Clear all filters and unhide any hidden rows in order to do this. Add a helper column to the table that contains theSUBTOTALformula and indicates whether a row has been filtered or not. If you want to handle filtered cells, use the function numargument 3: =SUBTOTAL =SUBTOTAL (3, A2) To discover all hidden cells that have been filtered out and manually concealed, enter 103 infunction num: =SUBTOTAL =SUBTOTAL (103, A2) To count only visible cells with text in this example, regardless of how other cells are hidden, we enter the second formula in A2 and copy it down to A10. The formula yields 1 for cells that are visible. The formula will return a value of 0 for any rows that have been excluded by filtering or manually hiding part of them. (Those zeros will not be shown since they are returned for rows that are not visible.) To verify that this is the case, copy the contents of a hidden cell containing the Subtotal formula to any visible cell, such as =D2, assuming row 2 is hidden. To count visible cells with text, use the COUNTIFS function with two different criteria range / criteriapairs:

- Criteria1 – searches for cells with any text (“*”) in the range A2:A10
- Criteria2 – searches for 1 in the range D2:D10 to detect visible cells
- Criteria3 – searches for 1 in the range D2:D10 to detect hidden cells
- Criteria4 – searches for 1 in the range D2:D10 to detect hidden cells
- Criteria5 – searches for 1 in the range D2:D10 to detect hidden cells
- Criteria6 – searches

In this step, you can filter the data in whichever manner you see fit. In our example, the formula will tell you how many filtered cells in column A contain text (3 in our case). If you do not want to add an additional column to your worksheet, you will need a more complex formula to do the task successfully. Simply pick the one that appeals to you the most: SUMPRODUCT (SUBTOTAL (103, INDIRECT(“A” ROW(A2:A10)), -(ISTEXT(A2:A10)) =SUMPRODUCT (SUBTOTAL (103, OFFSET(A2:A10, ROW(A2:A10) MIN(ROW(A2:A10)), – (ISTEXT(A2:A10)) =SUMPRODUCT (SUBTOTAL (103, The following will also work with the multiplication operator: =SUMPRODUCT(SUBTOTAL(103, INDIRECT(“A” ROW(A2:A10)) * (ISTEXT(A2:A10)) =SUMPRODUCT(SUBTOTAL(103, INDIRECT(“A” ROW(A2:A10)) * (ISTEXT(A2:A10)) =SUMPRODUCT(SUBTOTAL(103, OFFSET(A2:A10, ROW(A2 Your personal choice for the formula to choose is irrelevant; the outcome will be the same regardless of whatever formula you choose:

### How these formulas work

For example, the first formula makes use of theINDIRECTfunction to “feed” SUBTOTAL with the individual references of all cells inside the given range. The second formula accomplishes the same result by combining theOFFSET, ROW, and MIN functions in the same way. Using the SUBTOTAL function, you can get an array of 1s and 0s where 1s indicate visible cells and 0s represent hidden cells, respectively (like the helper column above). The ISTEXT function examines each cell in the range A2:A10 and returns TRUE if a cell includes text, and FALSE if it does not contain text.

At this stage, the formula appears to be the following: =SUMPRODUCT(,) In the first step, the SUMPRODUCT function multiplies the items of both arrays that are in the same places, and then sums the resultant array.

=SUMPRODUCT() Furthermore, the number of 1’s in the preceding array represents the number of visible cells that have text in them.

I appreciate you taking the time to read this and hope to see you on our blog next week!

### Available downloads

Excel formulae to count the number of cells containing text

## You may also be interested in

Watch this video to learn how to count the number of cells that contain text strings. In Excel, one of the most typical chores is counting, which is one of the most popular functions. It is one of the metrics that is frequently used to summarize large amounts of data. For example, you may tally the number of sales made by Bob, or the number of sales more than 500K, or the quantity of Product X sold. Excel includes a number of different count functions, and in the vast majority of cases, these built-in Excel functions would be sufficient.

- COMPARE AND DISTINGUISH– To determine the number of cells that contain numbers
- To keep track of the number of cells that are not empty, use the COUNTA function. COUNTBLANK is used to count the number of blank cells in a row. In order to count cells when the provided criteria are satisfied, use the COUNTIF / COUNTIFS command.

It is possible that you may encounter scenarios in which you will need to develop a mix of functions in order to complete the counting in Excel. The counting of cells that contain text strings is an example of this.

## Count Cells that Contain Text in Excel

Text values can take on a variety of shapes and sizes. It may be something like this:

- Text strings or alphanumeric characters are both acceptable. As an illustration, Trump Excel or Trump Excel 123

- A cell that seems to be blank yet includes the characters=””or'(if you just enter an apostrophe in a cell, it appears to be blank)

Take a look at the information in the following data set: Each of the text, number, blank, special character, and logical value combinations is represented in this table. We will use the following wildcard characters to count the number of cells that have text values:

- Asterisk (*): In Excel, an asterisk may represent any amount of characters. For example, the word ex*could stand for excel, excels, example, expert, and so on. Question Mark (?): A question mark is a single character that expresses one idea. Tr?mp, for example, might refer to either Trump or Tramp. Tilde (): Used to distinguish between wildcard characters in a string.

Also see:Examples of Using Wildcard Characters in Excel for more information. Let’s now build algorithms to count different combinations of items in our database.

### Count Cells that Contain Text in Excel (including Blanks)

The formula is as follows: =COUNTIF(A1:A11,”*”) This formula makes use of the COUNTIF function, which is used with a wildcard character in the selection criterion. Given that an asterisk (*) may represent any number of characters, it counts all of the cells in which text characters are contained. It even counts cells that contain an empty string (an empty string can be the result of a formula returning =”” or a cell containing an apostrophe, for example).

Despite the fact that a cell with an empty string seems to be blank, it is tallied by this formula. Logical values are not taken into consideration.

### Count Cells that Contain Text in Excel (excluding Blanks)

The formula is as follows: =COUNTIF(A1:A11,”?*”) It is necessary to include two wildcard characters in the criterion argument in order for this formula to be valid (question mark and asterisk). This implies that at the very least one character should be present in the cell. When a cell contains an empty string (such as an apostrophe or the symbol “”), this formula does not count it. Because an empty string has no characters, it does not fit the criterion and is thus not included in the count.

### Count Cells that Contain Text (excluding Blanks, including Logical Values)

The formula is as follows: =COUNTIF(A1:A11,”?*”) + SUMPRODUCT(–(ISLOGICAL(A1:A11)) + SUMPRODUCT(–(ISLOGICAL(A1:A11)) + SUMPRODUCT(–(ISLOGICAL(A1:A11)) + SUMPRODUCT(–(ISLOGICAL(A1:A11)) + SUMPRODUCT(–(ISLOGICAL(A1:A11)) + SUMPRODUCT(–(ISLOGICAL( The first section of the formula makes use of a mix of wildcard characters (* and?) to represent various symbols. This function returns the number of cells in which at least one text character can be found (counts text and special characters, but does not count cells with empty strings).

Whether or whether there is a logical value is determined by the ISLOGICAL function, which returns TRUE in Excel.

When this occurs, the ExcelSUMPRODUCT function simply returns the number of cells that have a logical value.

Similar to this, you may create formulae that calculate the SUM or AVERAGE of a range of cells based on the data type contained inside them.

- Count the number of words contained inside a text string Using Multiple Criteria in the COUNTIF and COUNTIFS Functions in Microsoft Excel. Learn how to count colored cells in Excel by following these steps. Excel formulas may be used to count the number of characters in a cell (or range of cells)

## How to count if cell contains text or part of text in Excel?

What if you have the following data and want to count the number of cells that include the text ” Apple “, the number of cells that contain the text ” Orange “, and the number of cells that contain the word ” Peach ” separately? How would you go about doing this? With the aid of this article, you will be able to rapidly count the number of cells in an Excel spreadsheet if they include text or a portion of text that matches a specified text string. In addition, we’ve included a fantastic function that allows you to accomplish it quickly and easily with a few clicks.

#### Count if cell contains text or part of text with the COUNTIF function

In Excel, the COUNTIF function may be used to count the number of cells that include a portion of text in a range of cells. Please complete the following steps. 1. Select a blank cell (for example, E5), paste the formula below into it, and then click the Enter key. 2. After that, drag the Fill Handle all the way down to see all of the results. =COUNTIF(B5:B10,”*” D5 “*”) =COUNTIF(B5:B10,”*” D5 “*”) COUNTIF is the syntax (range,criteria) Arguments

- Specify the range of cells you wish to count (this is essential). It is necessary to include criteria in order to select which cells will be counted. Criteria might be a number, expression, cell reference, or text string.

- The range of cells you wish to count is represented by the letters B5:B10 in the formula. D5 is the cell reference that contains the information you are looking for. You have the flexibility to modify the reference cell and the conditions in the formula as needed. If you wish to directly type the text into the formula to have it counted, please use the formula listed below: =COUNTIF(B5:B10,”*Apple*”)
- Because of this, there is no difference between upper and lower case.

#### Only several clicks can count if cell contains text or part of text in Excel:

In Kutools for Excel, you can easily count the number of cells in a range that contain a certain text or chunk of text by using theSelect Specific Cellsutility.

Following the display of the result in a pop-up dialog box, all matching cells will be chosen by default, unless otherwise specified. For further information, please see the link below. Kutools for Excel may be downloaded right now! (30-day no-obligation trial)

#### Count cells contain text with the COUNTIF function

For example, as seen in the picture below, if you wish to count the number of cells in a specific range that solely contain text, the approach described in this part can be of use to you. 1. To output the result, choose a blank cell in which to paste the formula below and press the Enter key. =COUNTIF(B5:B10,”*”)

#### Count if cell contains text or part of text with Kutools for Excel

Tip: In addition to the method above, we’ll show you how to use an incredible feature to quickly solve this problem. Kutools for Excel’s Select Specific Cellsfeature allows you to swiftly count the number of times a cell includes text or a portion of text with a few clicks. With this capability, you can even combine the countif condition with an OR or an AND condition as needed. Please complete the following steps. Prior to utilizing theKutools for Excel, you must first take a few minutes to free download and install the software.

Choose the range of cells in which you wish to count the number of cells that contain a specified text.

Select Specific Cells by selectingKutoolsSelectSelect Specific Cells.

In theSelect Specific Cellsdialog box, you must provide the following information:

- Choose the SelectCell option from theSelection typesection. To begin, selectContainsfrom the drop-down list and enterApplein the text box
- To continue, selectContainsfrom the drop-down list and enterApplein the text box
- To proceed, press the OK button. Then a popup box appears, informing you of the number of cells that fit the condition. Selecting all qualifying cells at one time is accomplished by clicking on theOKbutton.

Please click here to download this utility and then follow the on-screen instructions to run it for a 60-day trial period.

#### Related articles

In Excel, you may use the countif function with several conditions. The COUNTIF function in Excel may be used to compute the number of instances of a specific value in a list. Occasionally, though, we will need to count based on various criteria, making the process more complicated. This lesson will walk you through the process of achieving it. More information may be found by clicking here. In Excel, you can keep track of how many cells begin or end with a given text string. Consider the following scenario: you have a range of data and you want to count the number of cells in a worksheet that begin with “kte” or end with “kte.” Instead of laborious counting, this post will teach you various strategies that will save you time.

Count the number of times a given value appears on various worksheets.

For example, you could want to count the number of times a certain value “Excel” appears in several spreadsheets.

More information may be found by clicking here.

#### Demo: Count if cell contains text or part of text with Kutools for Excel

- Super Formula Bar (allows you to effortlessly change numerous lines of text and formula at the same time)
- Layout Reading (the ability to quickly read and alter vast numbers of cells)
- Copy and paste into the Filtered Range
- Cells, rows, and columns are merged while the data is retained. Separate the content of the cells
- Duplicate rows should be combined, and the sum/average should be calculated. Prevent the formation of duplicate cells. Compare the ranges
- Choose the rows that are duplicates or unique
- Blank Rows (all cells are empty) should be selected. Numerous Workbooks
- Super Find and Fuzzy Findin Many Workbooks
- Random Select
- CopyMultiple Cells in the same format without modifying the formula reference
- Create automatic references to many sheets
- Insert bullets, check boxes, and other formatting elements
- And more. Formulas, ranges, charts, and pictures may be saved as favorites and inserted quickly
- Cells should be encrypted with a password. Develop and send emails to a mailing list Text extraction, text addition, text removal by position, and space removal are all options. Paging Subtotals can be created and printed. Convert between the contents of cells and their comments
- Super Filter (allows you to save and reuse filter schemes across several pages)
- Advanced Sorting by month, week, day, frequency, and other criteria
- Special Filtering by bold and italic text
- Workbooks and WorkSheets should be combined. Tables can be merged depending on the columns that are important. Data should be divided into many sheets. Convert xls, xlsx, and pdf files in bulk
- Grouping by week number, day of the week, and other criteria in a pivot table. Cells that are unlocked and locked are represented by distinct colors. Cells with a formula or a name are highlighted.

- Make it possible to edit and view documents in tabbed mode in Microsoft Office applications including Word, Excel, PowerPoint, Publisher, Access, Visio, and Project. Instead of opening and creating several documents in separate windows, multiple documents can be opened and created in different tabs of the same window. increases your productivity by 50% and eliminates hundreds of mouse clicks for you on a daily basis

## Count Specific Text in a Cell

View this video to learn how to count particular text within a single worksheet cell using either Excel or Google Sheets formulae. Count all occurrences of a text string, or simply count full words in a text string.

## Count Text String in Cell

What is the total number of times a certain text string appears in a given worksheet cell?

- Specifically, the text string “air” is typed in cell B2:air
- In cells B5:B8, there are several text strings separated by commas
- And in cell B9:B8, there is no text string at all.

- Please keep in mind that some of the cells contain additional spaces before and after the commas.

Column C contains formulas that count the number of times the word “air” appears in the cell. With this formula, the text string is counted regardless of whether it is a whole word or a portion of a word.

NOTE: This formula (given below) will work in both Excel and Google Sheets, so don’t worry about which one you use.

### Formula to Count Specific Text String

This formula is entered in cell C5, and it is copied down to cell C8. It is written as follows:

- The product of (LEN(B5) – LEN(SUBSTITUTE(B5, $B$2,””)) is equal to the product of LEN($B$2) and LEN($B$2).

#### How It Works

The following is an explanation of how the formula works.

- LEN returns the length of the text entered into the cell: LEN(B5)
- SUBSTITUTE replaces all occurrences of the word “air” with the word “airless”:

LEN is a measure of how much text has been reduced. Taking the new length (14) and subtracting it from the previous length (23) The difference (9) is calculated by dividing it by the length of the particular text string (3) The outcome of this split is the number of occurrences in total (3) Here is the formula in the Excel formula bar, with the values for each part computed. (Select sections of the formula, then hit the F9 key to have that piece of the formula calculated.)

## Count Specific Text Items in Cell

Is there a certain text string that appears many times in a worksheet cell, each as a separate item?

- Specifically, the text string “air” is typed in cell B2:air
- In cells B5:B8, there are several text strings separated by commas
- And in cell B9:B8, there is no text string at all.

- Please keep in mind that some of the cells contain additional spaces before and after the commas.

#### Solutions for Excel and Google Sheets

There are a variety of solutions for this problem in Google Sheets and Excel, as well as other programs. With these formulae, the text string is only tallied if it is on its own between the commas in the formula (with or without space characters). -Google Sheets Formula -Excel 365 Formula -Excel Formula – Helper Column -Excel Formula – All-in-One -Google Sheets Formula -Excel 365 Formula -Excel Formula – Helper Column

### Google Sheets Formula

Because of the SPLIT function in Google Sheets, the Google Sheets calculation is significantly shorter than the Excel formula: This formula is entered in cell C5, and it is copied down to cell C8. It is written as follows:

#### How It Works

The following is an explanation of how the Google Sheets formula works.

- Replaces all of the space characters in a string with an empty string using the SUBSTITUTE function:

SPLIT creates an array of items that are divided by commas. COUNTIFcounts all of the elements in that array that match the text in cell B2 if the text in cell B2 is true. If the SPLIT function is the sole function in the formula, the following is what it accomplishes.

- The results fill the columns to the right as they are shown. The COUNTIF function might be used to count the number of things that were found in that range of cells.

By combining the functions SPLIT and COUNTIF, the results are all included in a single cell.

### Excel Formulas

Unfortunately, Excel does not have an SPLIT function, therefore a more complicated formula must be used instead. – If you have Excel 365, you may utilize the SEQUENCE function in a formula. – If you have Excel 2013 or later, you may utilize the FILTERXML function in the formula. Utilize the formula with an assistance column in older versions of Excel; alternatively, you may use the all-in-one formula if you like.

### Excel Formula – SEQUENCE

If you have Excel 365, you may use this formula, which incorporates the SEQUENCE function, to accomplish your goal. This formula was provided by UniMord, who is to be thanked! The SUM and SUBSTITUTE functions are also used in the formula, and the formula for cell C5 is shown below. For the sake of readability, I’ve included a few more space characters:

- $B$2 “,”,”,”$B$2 “,”) = SUM(- (SUBSTITUTE(“,”SUBSTITUTE(B5 –

#### How It Works

$B$2 “,”,”,”$B$2 “,”) = SUM(- (SUBSTITUTE(“,”SUBSTITUTE(B5 –

##### Formula Overview

I’ll take the following text string from cell B5 to demonstrate how to utilize this formula: Listed below is a summary of what the formula accomplishes:

- The vivid color blue Text String 1 is formed by the SUBSTITUTE function
- This is in contrast to Text String 2, which is created by the purple portion of the formulation.

- If the two text strings are not equal, the result is TRUE
- Otherwise, the result is FALSE. If they are equal, the outcome is FALSE
- Otherwise, the result is TRUE.

The two negative signs within the first bracket are used to transform those results to numerical representations. In this case, the SUM function sums those values together to obtain the total number of times the specified word appears in the cell as a separate item.

##### Bright Blue SUBSTITUTE

Text String 1 is created by the brilliant blue SUBSTITUTE with the help of four arguments: Textual Rebuttal Using the red section of the formula, you may combine three parts of text:

- A comma
- The text from cell B5, with the spaces replaced by empty strings
- Another comma
- The rest of the text from column B5.

The resulting text string is as follows:,air,dig,air,air, TextArgument from the past In the dark blue area of the formula, there are three pieces of text that are connected: The resulting text string is as follows:,air, New Text Argument It is an empty string in the black component of the formula:””Instance NumArgument The green section of the formula generates a list of integers, which looks like this:

- From 1 to the number of characters in cell B5 – LEN(B5)
- Starting at 1 and finishing at the number of characters in cell B5 – LEN(B5)

Because SEQUENCE is a spill function, it returns a collection of numbers rather than simply one single integer. Because there are 17 characters in cell B5, the following is the answer to the Instance Num argument:. 1,2,3,4,5,6,7,8,9.10,11,12,13,14,15,16,17

##### Bright Blue SUBSTITUTE

Because SEQUENCE is a spill function, the brilliant blue SUBSTITUTE function returns 17 text strings in addition to the original SEQUENCE. There is a single result for each sequence number in the database. If they were listed on a worksheet, the first six examples would be as follows:

- For example, in Example 1, the first,air, is removed, and the result isdig,air,air
- In Example 2, the first,air, is removed, and the result isdig,air,air
- In Example 3, the first,air, is removed, and the result isdig,air,air
- In Example 4, the first,air, is removed, and the result isdig,air,air
- In Example 5, the first,air, is removed, and the result isdig,air,air
- For example, in Example 2, the second,air,is eliminated, and the result is,air,digair
- In Example 3, the second,air,is removed, and the result is,air,digair
- For example, in number 3, the third element, air, is eliminated, and the result is, air, dig, air. Because there is no fourth instance in Example 4, the outcome is air, dig, air, air
- And air, dig, air, air.

##### Comparison Text String 2

It is the purple portion of the algorithm that generates the comparison text string -Text String 2. That portion of the formula that is highlighted in red links three bits of text, as seen in the following example:

- A comma
- The text from cell B5, with the spaces replaced by empty strings
- Another comma
- The rest of the text from column B5.

The resulting text string is as follows:,air,dig,air,air,

##### Compare Text Strings

Text String 1 is compared to Text String 2 using the NOT EQUAL operator – for each instance number.

- If the two text strings are not equal, the result is TRUE
- Otherwise, the result is FALSE. If they are equal, the outcome is FALSE
- Otherwise, the result is TRUE.

##### SUM the Results

Following that, the two minus signs within the first bracket are used to transform the TRUE/FALSE values to numbers. Last but not least, the SUM function sums those values together to provide the total number of times the given word appears in the cell, each as a distinct item.

### FILTERXML Formula

If you have Excel 2013, you may make use of the FILTERXML function. It is not accessible in either the online version of Excel or the Mac version of Excel. FILTERXML retrieves particular info from XMLcontent depending on an XPath that has been given. Because we used a specific search term, our formula will return specific items from comma-separated text. More information regarding FILTERXML may be found on the Microsoft website. NOTE: It was a fascinating adventure attempting to find out the FILTERXML solution, and I blogged about it on my Contextures blog at the time.

#### Create the XML

Our formula will be used to replace the commas in comma-separated text in order to generate XML code. For example, the following string of text is contained within a cell: house, dig, air, hair, air, dig, house, dig The formula will transform it into XML structures, such as this.

- The data in the cell is represented in this way. The components that are separated by commas are referred to as ilines. nis an attribute of 1 for each item, allowing them to be added together afterwards

A comment on Chandoo’s forum inspired this XML method, and you can learn more about XML (Extensible Markup Language) in this XML for the Uninitiated article on the Microsoft website.

#### XML Strings

At the top of the worksheet, there are four cells with strings to make it easy to construct each XML string individually.

We use the following formula to combine those numbers with the comma-separated text contained in a cell:

- Text in E1 appears before the cell text
- Text in F1 takes the place of the commas
- And text in G1 appears after the cell text. The text in G1 is placed after the cell text, and so on.

In this XML for the Uninitiated page on the Microsoft website, you may learn more about XML (Extensible Markup Language).

#### Create XPath

Cell H1 has a formula that mixes text with our search phrase and is used as the XPath argument. If the search term is dig, the following will be the XPath:

#### What It Means

The following is what the XPath will do in this example:

- All items that are equal to dig will have the n attribute (1) returned as their result. The normalize-space function, similar to Excel’s TRIM function, eliminates leading and trailing spaces as well as unnecessary spaces between words in a document.

#### FILTERXML Formula

This formula is in cell C5 of the Items XML sheet, and it is used to count the number of text items that match our search item:

- =IFERROR(SUM(FILTERXML($E$1SUBSTITUTE(B5,”,”,$F$1)$G$1,$H$1)),0
- =IFERROR(SUM(FILTERXML($E$1SUBSTITUTE(B5,”,”,$F$1)$G$1,$H$1),0
- =IFERROR(SUM(FILTERXML($E$1SUBSTITUTE(

#### How It Works

The following is an explanation of how the computation in the formula works:

- SUBSTITUTE replaces all of the commas in cell F1 with the following text string:

The text string from E1 is joined at the beginning of the string. At the conclusion of the text string from G1, a new text string is created. In cell H1, using the XPath in cell H1, FILTERTEXT returns the number attribute (1) from that XML code, and SUM provides the sum of all the 1s in cell H1. If no matching items are discovered, the IFERROR function returns a zero.

### Excel Formula Helper Column

In cell H1, using the XPath in cell H1, FILTERTEXT returns the number attribute (1) from that XML code, and SUM provides the sum of all the 1s in cell H1 If no matching items are discovered, IFERROR delivers a zero.

#### Separators

The Excel formula makes use of two named cells, SepSel and SepSel2, which are separated by commas. Those mentioned cells are located on the Administration sheet in the sample file.

#### Search String

Those separators are used to form a search string, which is then utilized to identify each individual item in the text cells. This formula may be found in cell D2 of the CountItems sheet in the example file, which is included with the file. Using the text value in cell B2, the formula creates a comma at the beginning and a pipe character (SelSep2) at the end, resulting in a text value in cell B2.

#### Helper Column Formula

It is possible to insert the whole Excel formula in a single cell, but having an assistance column would make it easier to grasp. In the helper column, the formula will generate a text string that will be used to indicate which items have been marked:

- Put a pipe character (SelSep2) at the beginning of each line
- Replace all commas (SelSep) with a pipe character and a comma, using SUBSTITUTE
- And add a comma at the end of each line
- Replace all spaces with empty strings, using SUBSTITUTE
- And put a comma at the beginning of each line

Here’s the formula from the helpful column to remember it by:

- =SelSep2 SUBSTITUTE(SUBSTITUTE(B5,” “,””), SelSep, SelSepSelSep2) SUBSTITUTE(SUBSTITUTE(B5,” “,””), SelSep, SelSepSelSep2) SUBSTITUTE(SUBSTITUTE(B5,” “,””), SelSep, SelSepSelSep2)

And here are the results in the assistance column for your convenience. Searching and counting objects that match the search phrase in the grey call -|air, for example – will be easy to do now.

#### Count Text Items Formula

The final formula will make use of the helper column in order to count the number of text elements. This formula is similar to the previous one on this page, which counted the number of times a text string appeared in a certain amount of space. However, in this formula, we will refer to the following: as an alternative to The formula for the Count column is as follows:

- =(LEN(D5) -LEN(SUBSTITUTE(D5,$D$2,””))) / LEN($D$2)
- =(LEN(D5) -LEN(SUBSTITUTE(D5,$D$2,””))) / LEN($D$2)

##### How It Works

The following is how the formula works:

- A value for LEN indicates how many characters are in the helper column text. It substitutes all instances of the string ” |air, ” with an empty string using the LEN(D5)
- SUBSTITUTE syntax: LEN(D5)
- SUBSTITUTE

LEN is a measure of how much text has been reduced. In this case, the new length (5) is deducted from the previous length (20) The difference (15) is calculated by dividing it by the length of the particular text string (5) The outcome of this split is the number of occurrences in total (3)

### Excel All-in-One Formula

Instead of creating a helper column on your worksheet, you may accomplish the identical results by using an all-in-one formula instead of a helper column.

Both of the following references to the helper column (D5) may be found in the Count formula mentioned above:

- =(LEN(D5) -LEN(SUBSTITUTE(D5,$D$2,””))) / LEN($D$2)
- =(LEN(D5) -LEN(SUBSTITUTE(D5,$D$2,””))) / LEN($D$2)

Replace the references with the following formula from the helper cell to create the all-in-one formula:

- >=

Listed below is the whole formula, along with the substitutions:

- =(SUBSTITUTE(SelSep2SUBSTITUTE(SUBSTITUTE(B5,” “,””), SelSep,SelSepSelSep2)SelSep)-LEN(SUBSTITUTE(SelSep2SUBSTITUTE(SUBSTITUTE(B5,” “,””), SelSep,SelSepSelSep2)

## DownloadSample File

- Formula for Microsoft Excel 365: To examine the example data and Microsoft Excel SEQUENCE formula from this page, download theCount Specific Cell Text with SEQUENCE workbook. xlsx format is used in the zipped file
- However, there are no macros included. Formulas in Microsoft Excel: Download the Count Specific Cell Text workbook to examine example data and calculations for Excel versions prior to Excel 2010. xlsx format is used in the zipped file
- However, there are no macros included. Google Sheets is a spreadsheet application developed by Google. Go to theCount Specific Items example Google Sheets workbook to see the sample data and Google Sheets calculations from this page in action. That file can only be seen. To make a duplicate of anything that you can modify, go to the File menu and choose Make a Copy.

## More Function Tutorials

The COUNT / COUNTIFCount criteria are found in the other column. Cells containing specific textCount the number of certain items in a list.