ZetCode

Excel COUNT Function

last modified April 4, 2025

The COUNT function is a fundamental statistical function in Excel. It counts the number of cells in a range that contain numbers. This tutorial provides a comprehensive guide to using the COUNT function. You'll learn its syntax, practical applications, and advanced techniques to master this essential Excel function.

COUNT Function Basics

The COUNT function counts cells containing numbers, dates, or text representations of numbers. It ignores empty cells, text, and logical values. The syntax is simple and flexible.

Component Description
Function Name COUNT
Syntax =COUNT(value1, [value2], ...)
Arguments 1-255 items to count
Return Value Count of numeric values

This table breaks down the essential components of the COUNT function. It shows the function name, basic syntax format, argument limits, and return value characteristics.

Basic COUNT Example

This example demonstrates the simplest use of the COUNT function with individual values.

Basic COUNT formula
=COUNT(5, "10", "Text", TRUE)

This formula counts numeric values: 5 and "10" (text converted to number). It ignores "Text" and TRUE. The result will be 2. This shows COUNT's basic behavior with mixed data types.

COUNT with Cell References

A more practical use of COUNT involves counting numeric values from specific cells. Here's an example with cell references.

A B
10
Text
30
=COUNT(A1:A3)

The table shows a simple spreadsheet with mixed content in column A and a COUNT formula in cell B4 that counts numeric values from A1 to A3.

COUNT with cell range
=COUNT(A1:A3)

This formula counts numeric values in cells A1 through A3. The result will be 2 (10 and 30). The text value in A2 is ignored. This demonstrates COUNT's core functionality.

COUNT with Dates

COUNT treats dates as numbers since Excel stores dates as serial numbers. This example shows COUNT with date values.

A B
1/1/2023
Meeting
2/1/2023
=COUNT(A1:A3)

This table demonstrates how COUNT handles dates mixed with text. The dates in A1 and A3 are counted as numbers, while the text in A2 is ignored.

COUNT with dates
=COUNT(A1:A3)

This formula counts the dates in A1 and A3 as numeric values. The result is 2. This shows that COUNT works with dates since Excel stores them as numbers.

COUNT with Logical Values

By default, COUNT ignores logical values (TRUE/FALSE). This example demonstrates this behavior.

A B
10
TRUE
FALSE
=COUNT(A1:A3)

The table shows how COUNT handles logical values mixed with numbers. Only the numeric value in A1 is counted, while TRUE and FALSE are ignored.

COUNT with logical values
=COUNT(A1:A3)

This formula counts only A1 (10), ignoring A2 (TRUE) and A3 (FALSE). The result is 1. To count logical values, you would need to use COUNTA instead.

COUNT with Error Values

COUNT ignores cells containing error values in its calculation. This example shows this behavior.

A B
10
#N/A
20
=COUNT(A1:A3)

The table demonstrates how COUNT reacts when encountering error values in the range. The #N/A error in A2 is ignored in the count.

COUNT with error values
=COUNT(A1:A3)

This formula counts A1 (10) and A3 (20), ignoring A2 (#N/A error). The result is 2. Unlike SUM, COUNT doesn't propagate errors in referenced cells.

COUNT with Multiple Ranges

COUNT can handle multiple ranges or combinations of ranges and individual cells. This example shows this flexibility.

A B C
5 Text
15 20
=COUNT(A1:B2, 25)

This table demonstrates COUNT's ability to combine different types of arguments. It shows values in cells A1 through B2 plus an additional number 25.

COUNT with multiple ranges
=COUNT(A1:B2, 25)

This formula counts numeric values in range A1:B2 (5, 15, 20) plus the number 25. The text in B1 is ignored. The result will be 4. This demonstrates COUNT's flexibility with arguments.

COUNT vs. COUNTA

It's important to distinguish between COUNT and COUNTA. COUNT only counts numeric values, while COUNTA counts all non-empty cells regardless of content.

A B C
10
Text
TRUE
=COUNT(A1:A3) =COUNTA(A1:A3)

The table compares COUNT and COUNTA results for the same range. COUNT returns 1 (only the number 10), while COUNTA returns 3 (all non-empty cells).

COUNT vs. COUNTA comparison
=COUNT(A1:A3)  // Returns 1
=COUNTA(A1:A3) // Returns 3

These formulas demonstrate the key difference between COUNT and COUNTA. COUNT is specific to numbers, while COUNTA counts any content. Choose the appropriate function based on your needs.

COUNT with Named Ranges

COUNT works seamlessly with named ranges, making formulas more readable. This example shows COUNT with a named range.

A B
100
Text
300
=COUNT(SalesData)

The table assumes cells A1:A3 are named "SalesData". The COUNT formula references this named range instead of cell addresses, improving formula clarity.

COUNT with named range
=COUNT(SalesData)

This formula counts numeric values in the named range "SalesData" (A1:A3). The result is 2 (100 and 300). Named ranges make formulas more understandable and maintainable.

COUNT with Dynamic Arrays

In modern Excel versions, COUNT can work with dynamic array formulas. This example demonstrates counting numeric values in a filtered range.

COUNT with FILTER function
=COUNT(FILTER(A1:A10, B1:B10="Active"))

This formula counts numeric values in A1:A10 where corresponding cells in B1:B10 contain "Active". The FILTER function creates a dynamic array that COUNT then processes. This enables conditional counting without COUNTIF.

The COUNT function is essential for data analysis in Excel. From basic counting to complex dynamic array operations, COUNT provides reliable numeric cell counting. Remember that COUNT specifically targets numeric values, ignoring text, blanks, and logical values by default. Mastering its various applications will enhance your data analysis skills.

Author

My name is Jan Bodnar, and I am a passionate programmer with extensive programming experience. I have been writing programming articles since 2007. To date, I have authored over 1,400 articles and 8 e-books. I possess more than ten years of experience in teaching programming.

List all Excel Formulas.