Mar 15, 2012

Count the number of cells/values by multiple group/criteria in Excel 在 Excel 中依照多個群組計算值的次數

Excel count the number of values by countif function:
在 Excel 中可以用 countif 函數來計算值出現的次數


If we need count the number of values by multiple columns:
如果需要依照多個群組來計算的話:







We need to use countifs function to set multiple criteria.
Type "COUNTIFS($A$2:$A$6,D2,$B$2:$B$6,E1)" in E2 and copy and adjust this formula to other cells.

就需要利用 countfis 函數來達成,
在 E2 儲存格中輸入 "COUNTIFS($A$2:$A$6,D2,$B$2:$B$6,E1)",其他儲存格則需要略為調整.
在E


$A$2:$A$6,D2 is the first criterion and means count number of values that equal D2("A") in area A2 to A6 cells.
$B$2:$B$6,E1 is the second criterion and means count number values that equal E1("10") in area A2 to A6 cells.

$A$2:$A$6,D2 是第一組條件,表示計算在 A2到A6的儲存格中,相等於D2的值("A")有幾個。
$B$2:$B$6,E1 是第二組條件,表示計算在 B2到B6的儲存格中,相等於E1的值("10")有幾個。


By the way, in you know how SUMPRODUCT function works, you can using "SUMPRODUCT(($A$2:$A$6=D2)*($B$2:$B$6=E1))"
而如果知道 SUMPRODUCT 函數怎麼運用的話,還可以輸入以下公式來替代:
"SUMPRODUCT(($A$2:$A$6=D2)*($B$2:$B$6=E1))"

No comments:

Post a Comment