COUNT function

  • Thread starter Thread starter trip_to_tokyo
  • Start date Start date
T

trip_to_tokyo

The following example is from Microsoft documentation.

Enter the following information in the quoted cells.

A2 Sales
A3 12/08/2008
A4
A5 19
A6 22.24
A7 TRUE
A8 #DIV/0!

Cell A4 is blank (contains nothing / no value).

In cell A12 (can be any cell) enter the following formula:-

=COUNT(A2:A8,2)

The above formula returns 4.

Why does it return 4?

According the Microsoft documentation:-

Counts the number of cells that contain numbers in the list, and the value 2
(4)

I reckon the answer should be (interpreting MS dcoumentation literally) 5
broken down as follows:-

A3 is 1.
A5 is 1.
A6 is 1.
A3 contains a 2 therefore count 1.
A6 contains a 2 therefore count 1.

I make that a total of 5.

Why then does the formula return 4?

Thanks for any help.

Steve
 
COUNT() counts the number of cells that contain numbers.
Here A3,A5,A6 and the number you have added to the formula ie 2 is counted.

What you are looking for is COUNTIF() .
=COUNTIF(A2:A8,2) returns the number of cells with ** cell value *** 2. 12
or 23 will not be counted..

If this post helps click Yes
 
May be to avoid confusion you can try which will count the numbers in A2:A8
and the 3 numbers specified in the formula .Also refer the help on COUNTIF()

=COUNT(A2:A8,2,3,4)
 
Back
Top