1. 首頁
  2. 其他

Excel專家教你countif函式的使用方法-countif函式教程

Excel專家教你countif函式的使用方法-countif函式教程

導語:小編為幫助讓大家更好地瞭解、掌握Countif函式便用方法,現羅列一些例項如下,希望能夠幫助大家更好地使用Countif函式。

一、求各種型別單元格的個數

(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 =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)

看後是不是明白了不少?