ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   COUNT function (https://www.excelbanter.com/excel-worksheet-functions/235267-count-function.html)

trip_to_tokyo[_2_]

COUNT function
 
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


Jacob Skaria

COUNT function
 
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
---------------
Jacob Skaria


"trip_to_tokyo" wrote:

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


Jacob Skaria

COUNT function
 
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)
--
If this post helps click Yes
---------------
Jacob Skaria


"Jacob Skaria" wrote:

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
---------------
Jacob Skaria


"trip_to_tokyo" wrote:

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



All times are GMT +1. The time now is 08:31 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com