Table of Contents[Hide][Show]
The excel count function returns the number of entries in a number field in a range. This means that only numbers would be counted within the range selected. These could be positive or negative numbers, percentages, dates, time, fractions, and even formulas that output numerical values. However, empty cells and text values are ignored. Now that we have introduced the count function, let's take a look at how the formula works.
Syntax
The syntax for the count function is as follows:
=COUNT(value1, value2, value3....)
The values (Value 1, Value 2, Value 3....) in the above syntax serve as arguments and the count function can take multiple arguments. These arguments can be hardcoded within the formula or can be selected from a range of cells.
Hardcoded Arguments
As established in the syntax section, the Count function can be used with the values hardcoded (embedded) within the formula. You should note however that hardcoded text values are ignored in the formula. Let's see some examples below:
=COUNT(1,"C","E","J") // returns 1
=COUNT(20,"Banana","Mango","Pear",50) // returns 2
From the above examples, you can see that every text value is excluded from the result.
Selected from a Range of Cells
This is the most commonly used method for the Count function. rather than having to manually input the values within the formula, you can just select a contiguous data set for excel to return the number of cells within that data set containing numerical values.
Let's assume we want to count the number of numerical values within the range B1: B50, the syntax would be edited as shown below.
Now let's take a visual representation. In our example below we have a range containing both numerical and text data. To apply the count function on our range we just need to follow the steps discussed below.
Step 1: Create a cell outside you data set for calculating the count and type in the syntax =COUNT(B3:B12)
Step 2: Press enter and you are done, simple as that.