当前位置:首页经验技巧Excel经验excel图表

excel表格COUNTIF函数常规用法

2024-07-23 15:03:07

一、求各种类型单元格的个数

(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,"<50")

(4)大于或等于50:=COUNTIF(data,">=50")

(5)小于或等于50:=COUNTIF(data,"<=50")

(6)大于E5单元格的值:=COUNTIF(data,">"&$E$5)

(7)等于E5单元格的值:=COUNTIF(data,$E$5)

(8)小于E5单元格的值:=COUNTIF(data,"<"&$E$5)

(9)大于或等于E5单元格的值:=COUNTIF(data,">="&$E$5)

(10)小于或等于E5单元格的值:=COUNTIF(data,"<="&$E$5)

三、等于或包含某N个特定字符的单元格个数

(1)两个字符:=COUNTIF(data,"??")

(2)两个字符并且第2个是B:=COUNTIF(data,"?B")

(3)包含B:=COUNTIF(data,"*B*")

(4)第2个字符是B:=COUNTIF(data,"?B*")

(5)等于“你好”:=COUNTIF(data,"你好")

(6)包含D3单元格的内容:=COUNTIF(data,"*"&D3&"*")

(7)第2字是D3单元格的内容:=COUNTIF(data,"?"&D3&"*")

注:countif()函数对英文字母不区分大小写,通配符只对文本有效

四、两个条件求个数

(1)>10并且<=15=SUM(COUNTIF(data,">"&{10,15})*{1,-1})

(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

五、各种特殊统计要求的计算A1:A100为存放数据的区域

(1)非空文本(仅包括可键入文本:=COUNTIF(A1:A100,">=!")

(2)所有非空文本=COUNTIF(A1:A100,">=!")+COUNTIF(A1:A100,">="&CHAR(1))-COUNTIF(A1:A100,">=")或{=SUM(COUNTIF(A1:A100,">="&{"!",""})*{1,-1})+COUNTIF(A1:A100,">="&CHAR(1))}即文本型-含" "(空格)数量

(3)全部可见单元格{=SUM(N(IF(ISERROR(A1:A100),1,SUBSTITUTE(A1:A100," ",""))<>""))},即全部看上去不是空值的单元格(=全部记录-真空-空格)

(4)有效可见单元格=COUNTIF(A1:A100,">=!")+COUNTIF(A1:A100,">="&CHAR(1))-COUNTIF(A1:A100,">= ")+COUNT(A1:A100),即所有非空文+数字型数据之和

(5)全部不见单元格(真空+空格+空文本)=COUNTIF(A1:A100,"")+COUNTIF(A1:A100,">=!")+COUNTIF(A1:A100,">=")

(6)空格=COUNTIF(A1:A100,">=")-COUNTIF(A1:A100,">=!")

(7)空文本""=COUNTIF(A1:A100,"")-COUNTIF(A1:A100,"=")

(8)逻辑与错误=COUNTIF(A1:A100,"<>")-COUNTIF(A1:A100,"*")-COUNT(A1:A100)


电脑版

免责声明:本站信息来自网络收集及网友投稿,仅供参考,如果有错误请反馈给我们更正,对文中内容的真实性和完整性本站不提供任何保证,不承但任何责任,谢谢您的合作。
版权所有:五学知识网 Copyright © 2015-2024 All Rights Reserved .