# How to Count Cells with Text in Excel Using Formulas?

If you need to **count the number of cells that contain text** in Microsoft Excel, there are several simple formulas you can use. Counting text values is a common task when working with spreadsheets that contain a mix of text and numerical data. This article will show you how to easily count cells with text in Excel using functions like COUNTIF, SUMPRODUCT, and LEN.

## What Does It Mean to Count Cells with Text?

In an Excel spreadsheet, a cell can contain different types of data:

- Text values, like names, labels, categories, or any combination of characters
- Numeric values, like amounts, percentages, measurements, or calculations
- Blank cells that don’t contain any data

Sometimes you may need to know the count or total of just the text cells, excluding blank cells and cells with numbers. Counting cells based on whether they contain text allows you to quickly see how many text values are in a dataset. This can be useful for analyzing categorical data, validating data entry, or getting a summary of text-based information.

## Excel Formulas to Count Cells Containing Text

Here are the best formulas to use in Excel to count the number of cells that contain text values:

### 1. The COUNTIF Function

The **COUNTIF function** is a powerful tool that counts the number of cells in a range that meet a certain criteria. To count text cells, we can use COUNTIF with a wildcard (*) to check for any cells that contain text characters.

Formula:

`=COUNTIF(range, "*")`

`range`

: The range of cells you want to count, like A1:A10`*`

: A wildcard character that matches any text value

For example, if you have a list of names in cells A1 to A20, you can use `=COUNTIF(A1:A20, "*")`

to count how many of those cells contain text (i.e. have a name entered).

### 2. The SUMPRODUCT and ISTEXT Functions

Combining the **SUMPRODUCT and ISTEXT functions** is another effective way to count cells with text. The ISTEXT function checks each cell and returns TRUE if it contains text. SUMPRODUCT then sums up the TRUE values as 1s to calculate the total count.

Formula:

`=SUMPRODUCT(--ISTEXT(range))`

`range`

: The range of cells to check for text, like B2:B25`--`

: Double unary operators to convert TRUE/FALSE to 1/0`ISTEXT`

: Checks each cell in the range and returns TRUE if it contains text`SUMPRODUCT`

: Sums the array of 1s and 0s to get the count of text cells

This formula works by first using ISTEXT to check each cell in the range. If a cell contains text, ISTEXT returns TRUE, otherwise it returns FALSE for blank cells or numbers. The `--`

then converts the TRUE/FALSE values to 1s and 0s. Finally, SUMPRODUCT sums up the 1s to get the total count of cells with text.

### 3. The SUM and LEN Functions

You can also use a combination of the **SUM function and LEN function** (which returns the length of text in a cell) to count cells that contain any text characters. If a cell is blank or contains a number, the LEN function will return 0. So by summing the LEN of each cell and checking for values greater than 0, we can effectively count the number of cells with text.

Formula:

`=SUM(LEN(range)>0)`

`range`

: The range of cells you want to count text in`LEN`

: Returns the length of the text in each cell, 0 for blank cells or numbers`>0`

: Changes positive lengths to 1 (for cells with text) and 0 to 0 (blank cells or numbers)`SUM`

: Adds up the 1s to get the count of text cells

The LEN function calculates the number of characters in each cell of the range. The `>0`

compares those lengths to 0, resulting in an array of 1s and 0s, where 1 indicates the cell has text and 0 means it is blank or numeric. SUM then adds up the 1s to get the total count of cells containing text.

## Which Formula Should You Use?

All of these formulas will return the same result – the count of cells containing text in the specified range. So which one should you choose? It depends on your specific needs and preferences:

Formula | Pros | Cons |
---|---|---|

COUNTIF | Simple and easy to understand | Doesn’t handle leading/trailing spaces |

SUMPRODUCT with ISTEXT | Can handle cells with leading/trailing spaces | Slightly more complex formula |

SUM with LEN | Counts all cells that contain any text characters | Doesn’t distinguish cells with only spaces |

In most cases, the straightforward `COUNTIF`

formula will suffice. But if your data includes cells with leading or trailing spaces, or you need to handle unique scenarios, the other formulas provide more flexibility and accuracy.

## Tips for Counting Text Values in Excel

Here are a few tips and best practices to keep in mind when counting cells with text in your Excel spreadsheets:

### Double-Check the Cell Range

Before using a formula, make sure it is referring to the correct **range of cells** that you want to analyze. Double-check that the cell references accurately cover the data you need to count, and adjust them if necessary.

### Copy Formulas Across Columns or Rows

After entering your **counting formula** in one cell, you can easily copy/drag it to other cells or columns to count text in different ranges. This is especially helpful if you have several columns or sections of data that you need to get text totals for.

### Use Absolute and Relative Cell References

To keep your **cell references** consistent when copying formulas, use **absolute cell references** like $A$1 for parts of the formula that shouldn’t change, and **relative references** like A1 for the parts that should adjust based on the new cell location.

### Count Cells Meeting Multiple Criteria

To count cells that contain text **and** meet other criteria, you can use the COUNTIFS function (plural) with multiple range/criteria arguments. For example:

`=COUNTIFS(A2:A10, "*", B2:B10, ">1000")`

This formula counts cells in the range A2:A10 that have text **and** corresponding values greater than 1000 in B2:B10.

### Compare Text Cell Counts to Totals

Often you’ll want to compare the **number of text cells** to the total number of cells, or display it as a percentage. You can combine a text counting formula with other functions to perform additional calculations.

For example, to calculate the percentage of cells in a range that contain text:

`=COUNTIF(A1:A100,"*") / COUNTA(A1:A100)`

This formula counts the text cells with COUNTIF and divides the result by the COUNTA of the range (which counts all non-blank cells).

## Wrapping Up

Counting cells that contain text values is an essential skill for working with and analyzing data in Microsoft Excel. With easy-to-use formulas like COUNTIF, SUMPRODUCT with ISTEXT, and SUM with LEN, you can quickly calculate the number of text cells in any range of your spreadsheet.

By applying the tips and best practices covered in this article, you’ll be able to efficiently summarize and explore your Excel data to gain valuable insights. Whether you’re working with a small table or a large, complex dataset, these text counting formulas will help you streamline your workflow and get the information you need.

## People Also Ask

### What is the easiest formula to count cells with text in Excel?

The easiest formula to count cells with text in Excel is the COUNTIF function with a wildcard (*). For example: `=COUNTIF(A1:A10, "*")`

### How do I count cells that contain text and meet other criteria?

To count cells that contain text and meet other criteria, use the COUNTIFS function with multiple range/criteria arguments. For example: `=COUNTIFS(A2:A10, "*", B2:B10, ">1000")`

### Can I copy and paste a text counting formula to other cells?

Yes, after entering a text counting formula in one cell, you can copy and paste or drag it to other cells or columns to count text in different ranges. This is helpful when working with multiple columns or sections of data.

### How do I calculate the percentage of cells that contain text?

To calculate the percentage of cells that contain text, divide the count of text cells by the total count of non-blank cells. For example: `=COUNTIF(A1:A100,"*") / COUNTA(A1:A100)`

### What’s the difference between absolute and relative cell references?

Absolute cell references (like $A$1) don’t change when copying formulas, while relative references (like A1) adjust based on the new cell location. Use absolute references for parts of the formula that shouldn’t change and relative references for parts that should adjust.

### Which function can handle counting cells with leading or trailing spaces?

The SUMPRODUCT function combined with ISTEXT can handle counting cells that contain leading or trailing spaces. For example: `=SUMPRODUCT(--ISTEXT(A1:A10))`

Vaishvi Desai is the founder of Excelsamurai and a passionate Excel enthusiast with years of experience in data analysis and spreadsheet management. With a mission to help others harness the power of Excel, Vaishvi shares her expertise through concise, easy-to-follow tutorials on shortcuts, formulas, Pivot Tables, and VBA.