Use COUNTIF, one of the statistical functions, to count the number of cells that meet a criterion; for example, to count the number of times a particular city appears in a customer list. In its simplest form, COUNTIF says: =COUNTIF(Where do you want to look?, What do you want to look for?)
In a blank cell enter the formula =COUNTIF(A1:A40,"<>*count*") and then press the Enter key. Then you will get the number of cells which don't contain the specific text of "count" in the specific Range A1:A40.
You can pass "<>"
(including the quotes) as the parameter for criteria
. This basically says, as long as its not empty/blank, count it. I believe this is what you want.
=COUNTIF(A1:A10, "<>")
Otherwise you can use CountA
as Scott suggests
COUNTIF function will only count cells that contain numbers in your specified range.
COUNTA(range) will count all values in the list of arguments. Text entries and numbers are counted, even when they contain an empty string of length 0.
Example: Function in A7 =COUNTA(A1:A6)
Range:
A1 a
A2 b
A3 banana
A4 42
A5
A6
A7 4 -> result
Google spreadsheet function list contains a list of all available functions for future reference https://support.google.com/drive/table/25273?hl=en.
The criterium should be "?*"
and not "<>"
because the latter will also count formulas that contain empty results, like ""
So the simplest formula would be
=COUNTIF(Range,"?*")
If you have cells with something like =""
and don't want to count them, you have to subtract number of empty cells from total number of cell by formula like
=row(G101)-row(G4)+1-countblank(G4:G101)
In case of 2-dimensional array it would be
=(row(G101)-row(A4)+1)*(column(G101)-column(A4)+1)-countblank(A4:G101)
Tested at google docs.
Sample file
Note:
=""
is a blank cell) without a need to use data
twice. The solution for goolge-spreadhseet: =ARRAYFORMULA(SUM(IFERROR(IF(data="",0,1),1)))
. For excel ={SUM(IFERROR(IF(data="",0,1),1))}
should work (press Ctrl+Shift+Enter in the formula).COUNTIF
function can count cell which specific condition
where as COUNTA
will count all cell which contain any value
Example: Function in A7
: =COUNTA(A1:A6)
Range:
A1| a
A2| b
A3| banana
A4| 42
A5|
A6|
A7| 4 (result)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With