Advertisement

Use the COUNT function

The COUNT function counts the number of numbers. It can include up to 255 arguments. Each argument can be an empty argument, a number, a name, an array, a formula, a logical value, a function, a reference, or a text representation of a number.

Syntax:

COUNT(argument1, argument2, ...)

The first argument is required; all other arguments are optional. In the following example: =COUNT(3,5,2), Excel counts the numbers and returns 3.

When using the COUNT function, how Excel treats a data type may depend on whether the data type is located in a cell, is located in an array, or is an argument. TRUE and FALSE are logical values. Refer to Use Excel Formulas to Make Comparisons or Join Text to learn more about logical values. Dates are stored as numbers. In a cell, Excel considers a number preceded by an apostrophe text. In a formula and in a function, Excel considers a number enclosed in double quotes text.

If a cell is empty, contains a logical value, text, or an error value Excel ignores the cell. If an array contains a logical value, text, or an error value, Excel ignores the logical value, text, or error value.

When evaluating arguments, if an argument is a logical value or text that Excel can convert to a number it is included in the count. Dates and empty arguments are also included in the count. Excel ignores text that it cannot convert to a number. For example, = COUNT(TRUE, FALSE) returns 2,  =COUNT("2","1") returns 2, =COUNT(1/1/2012, 5/31/2015) returns 2 , =COUNT(2,,3), returns 3, and =COUNT("Two", "1") returns 1.

In the following worksheet, all of the cells that have orange text contain a calculation. All of the calculations use the COUNT function. Feel free to modify them and to create your own functions.

The Advanced Examples Tab Explained

Example 1

Excel evaluates each of the arguments, 6, 7 ,9, 3, and 2; then returns the count, 5.

Example 2

Excel evaluates each of the numbers in cells A1:A5: 6, 7, 9, 3, and 2; then returns the count, 5

Example 3

Excel evaluates each of the arguments: 3, FALSE, 8, "1", "two", empty argument, 1/1/2012—a date, and 0. Three (3) is a number. Excel counts it. FALSE is a logical value. Excel counts it. Eight (8) is a number. Excel counts it. Excel can convert the text "1" to a number. Excel counts it. Excel cannot convert the text "two" to a number. Excel does not count it. Excel counts the empty argument. Excel counts the date, 1/1/2012. Zero (0) is a number. Excel counts it. Excel returns 7.

Example 4

Excel evaluates each of the values in cells B1:B8: 3, FALSE, 8, '1, two, empty cell, 1/1/2012—a date, and 0. Cell B1 (3) is a number. Excel counts it. Cell B2 (FALSE) is a logical value. Excel ignores it. Cell B3 (8) is a number. Excel counts it. Cell B4 ('1) is text. Excel ignores it. Cell B5 (two) is text. Excel ignores it. Cell B6 is empty. Excel ignores it. Cell B7 (1/1/2012) is a date. Excel counts it. Cell B8 (0) is a number. Excel counts it. Excel returns 4.

Example 5

This example includes an array. Excel multiplies 2 times 5 and gets 10, 3 times 5 and gets 15, 4 times 5 and gets 20. It then returns a count of 3.

Tip

You can also use AutoSum to access the COUNT function. Click the down-arrow associated with the AutoSum button on the Home tab. Then click Count. When you access the COUNT function through AutoSum, Excel provides you with extra features that enable you to count numbers quickly. For example, you can quickly count the number of numbers in each column or each row in a set of columns or rows. AutoSum COUNT has the same features as AutoSum SUM does.  Click here to find out more about AutoSum.

Leave a Comment



HTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>