ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   How to calculate the number of non-zero cells in range? (https://www.excelbanter.com/excel-discussion-misc-queries/238244-how-calculate-number-non-zero-cells-range.html)

Claudia d'Amato

How to calculate the number of non-zero cells in range?
 
I would like to count the number of non-zero (=non-blank) cells in a range (say D9:D30).

How can I do this with an Excel formula ?

Claudia


Gord Dibben

How to calculate the number of non-zero cells in range?
 
COUNTA will count all non-blank cells............text or numeric.

COUNT will count all numeric cells.


Gord Dibben MS Excel MVP

On 28 Jul 2009 21:30:25 GMT, (Claudia d'Amato)
wrote:

I would like to count the number of non-zero (=non-blank) cells in a range (say D9:D30).

How can I do this with an Excel formula ?

Claudia



Lars-Åke Aspelin[_2_]

How to calculate the number of non-zero cells in range?
 
On 28 Jul 2009 21:30:25 GMT, (Claudia d'Amato)
wrote:

I would like to count the number of non-zero (=non-blank) cells in a range (say D9:D30).

How can I do this with an Excel formula ?

Claudia



Take a look at the worksheet function COUNTA()

Hope this helps / Lars-Åke

T. Valko

How to calculate the number of non-zero cells in range?
 
Do any of the cells contain formula blanks?

Try one of these (accounts for formula blanks):

=SUMPRODUCT(--(LEN(D9:D30)0))

=ROWS(D9:D30)-COUNTBLANK(D9:D30)

--
Biff
Microsoft Excel MVP


"Claudia d'Amato" wrote in message
...
I would like to count the number of non-zero (=non-blank) cells in a range
(say D9:D30).

How can I do this with an Excel formula ?

Claudia




jasontferrell

How to calculate the number of non-zero cells in range?
 
Here is one that will account for either blanks or zeros. I wasn't
clear from the original question if we need to exclude both.

=SUMPRODUCT((NOT(ISBLANK(D9:D30))*1)*(NOT(D9:D30=0 )*1))

Claudia d'Amato

How to calculate the number of non-zero cells in range?
 
Your solution is NOT working, if a cell contains a formula!

So if a cell contains e.g.=SUM(A5:A15) then is cell is non-blank and
counts as 1. But this is not intended.

If the formula evaluates to 0 then this cell should NOT count.
I need a solution which evaluates any possibly existing formulas at
first and then checks if the cell is non-blank/non-zero.

Any other solutions than COUNTA() for this task?

Claudia

On Tue, 28 Jul 2009 14:35:59 -0700, Gord Dibben <gorddibbATshawDOTca
wrote:

COUNTA will count all non-blank cells............text or numeric.

COUNT will count all numeric cells.


Gord Dibben MS Excel MVP

On 28 Jul 2009 21:30:25 GMT, (Claudia d'Amato)
wrote:

I would like to count the number of non-zero (=non-blank) cells in a range (say D9:D30).

How can I do this with an Excel formula ?

Claudia



ryguy7272

How to calculate the number of non-zero cells in range?
 
This function will count non-blanks:
=SUMPRODUCT(--(A1:A20<""))
Note, Enter as Ctrl + Shift + Enter, not just Enter

This will count blanks:
=COUNTIF(A1:A20,"")
Normal Enter

This will count values 0:
=SUMPRODUCT(--(A1:A200))
Note, Enter as Ctrl + Shift + Enter, not just Enter

Just for fun...this will count zeros:
=COUNTIF(A1:A20,0)
Normal Enter




HTH,
Ryan---
--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.


"Claudia d'Amato" wrote:

Your solution is NOT working, if a cell contains a formula!

So if a cell contains e.g.=SUM(A5:A15) then is cell is non-blank and
counts as 1. But this is not intended.

If the formula evaluates to 0 then this cell should NOT count.
I need a solution which evaluates any possibly existing formulas at
first and then checks if the cell is non-blank/non-zero.

Any other solutions than COUNTA() for this task?

Claudia

On Tue, 28 Jul 2009 14:35:59 -0700, Gord Dibben <gorddibbATshawDOTca
wrote:

COUNTA will count all non-blank cells............text or numeric.

COUNT will count all numeric cells.


Gord Dibben MS Excel MVP

On 28 Jul 2009 21:30:25 GMT, (Claudia d'Amato)
wrote:

I would like to count the number of non-zero (=non-blank) cells in a range (say D9:D30).

How can I do this with an Excel formula ?

Claudia





All times are GMT +1. The time now is 06:05 AM.

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