COUNTIF函数用法大全
时间:2023-08-15 17:53:09
一、求各种类型单元格的个数
(1) 求真空单元格单个数: =COUNTIF(data,"=")
(2) 真空+假空单元格个数: =COUNTIF(data,"") 相当于countblank()函数
(3) 非真空单元格个数: =COUNTIF(data,"<>") 相当于counta()函数
(4) 文本型单元格个数: =COUNTIF(data,"*") 假空单元格也是文本型单元格
(5) 区域内所有单元格个数: =COUNTIF(data,"<>""")
(6) 逻辑值为TRUE的单元格数量 =COUNTIF(data,TRUE)
小说明:
EXCEL单元格内数据主要有以下几类:数值型,文本型,逻辑型,错误值型。其中时间类型也是一种特殊的数值。文本类型的数字是文本型。
空单元格:指什么内容也没有的单元格,姑且称之为真空。
假空单元格:指0字符的空文本,一般是由网上下载来的或公式得来的,姑且称之为假空。
date指单元格区域,该参数不能是数组。
二、求><=某个值的单元格个数
(1) 大于50 =COUNTIF(data,">50")
(2) 等于50 =COUNTIF(data,50)
(3) 小于50 =COUNTIF(data,"
(5) 小于或等于50 =COUNTIF(data,"
(7) 等于E5单元格的值 =COUNTIF(data,$E$5)
(8) 小于E5单元格的值 =COUNTIF(data,"<"&$E$5)
(9) 大于或等于E5单元格的值 =COUNTIF(data,">="&$E$5)
(10) 小于或等于E5单元格的值 =COUNTIF(data,"
(2) >=10并且<15 =SUM(COUNTIF(data,">="&{10,15})*{1,-1})
(3) >=10并且<=15 =SUM(COUNTIF(data,{">=10",">15"})*{1,-1})
(4) >10并且<15 =SUM(COUNTIF(data,{">10",">=15"})*{1,-1})
注:一般多条件计数使用SUMPRODUCT函数,以上方法较少使用,仅供参考。
补充:三个区域计数:
三个区域中>=60 =SUM(COUNTIF(INDIRECT({"a46:a48","b48:b50","c47:c48"}),">=60"))
五、各种特殊统计要求的计算 A2:A32 为存放数据的区域
(1)非空文本(仅包括可键入文本) =COUNTIF(A2:A32,">=!")
(2)所有非空文本 =COUNTIF(A2:A32,">=!")+COUNTIF(A2:A32,">="&CHAR(1))-COUNTIF(A2:A32,">= ") 或 {=SUM(COUNTIF(A2:A32,">="&{"!"," "})*{1,-1})+COUNTIF(A2:A32,">="&CHAR(1))}
(3)全部可见单元格 {=SUM(N(IF(ISERROR(A2:A32),1,SUBSTITUTE(A2:A32," ",""))<>""))}
(4)有效可见单元格 =COUNTIF(A2:A32,">=!")+COUNTIF(A2:A32,">="&CHAR(1))-COUNTIF(A2:A32,">= ")+COUNT(A2:A32)
(5)全部不见单元格(真空+空格+空文本) =COUNTIF(A2:A32,"")-COUNTIF(A2:A32,">=!")+COUNTIF(A2:A32,">= ")
(6)空格 =COUNTIF(A2:A32,">= ")-COUNTIF(A2:A32,">=!")
(7)空文本"" =COUNTIF(A2:A32,"")-COUNTIF(A2:A32,"=")
(8)逻辑与错误 =COUNTIF(A2:A32,"<>")-COUNTIF(A2:A32,"*")-COUNT(A2:A32)