Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Excel: return the number of cells that are not blank

Tags:

function

excel

I am trying to find a function that will return the number of cells within a given range that have a number in them. I want to count the number of responses that people gave, irregardless of the value they entered in the cell.
How do I do this?

like image 200
brainman Avatar asked Jun 06 '12 20:06

brainman


2 Answers

If you are looking for a number of cells containing numeric values, then COUNT() function is what you're looking for:

=COUNT(A1:D6)

If you are looking number of cells with non-blank values (numeric or otherwise), then COUNTA() is the right function:

=COUNTA(A1:D6)

The last formula works only if none of the cells have empty strings as values (i.e. none of the cells in the range have ="" or something equivalent in them). If that is the case, then this formula should be used instead:

=SUMPRODUCT((E7:G10<>"") * 1)
like image 112
ikh Avatar answered Sep 18 '22 16:09

ikh


You can use the LEN function to find the length of the input of a cell, and then test if it's greater than zero or not.

=LEN(A1)>0
like image 43
Hans Z Avatar answered Sep 16 '22 16:09

Hans Z