使用FILTER在COUNTA上返回1

Bla*_*nix 4 google-sheets

我正在尝试制作一张表来计算数据实例的数量,并将某些响应组合在一起.我正确地想出三个公式时遇到了问题.以下是我最好的猜测和一些英语,以帮助澄清我想要完成的事情.

//Count all cells that are Warrior or Paladin [Always returns 1, and not zero]
=COUNTA(FILTER(I:I, OR(I:I="Warrior", I:I="Paladin")))

//Count all cells that are Scholar or White Mage [Always returns 1, and not zero]
=COUNTA(FILTER(I:I, OR(I:I="Scholar", I:I="White Mage")))

//Count all cells that are do not all within the first sets of requirements [Always returns 1, not 2]
=COUNTA(FILTER(I:I, NOT(OR(I:I="Warrior", I:I="Paladin", I:I="Scholar", I:I="White Mage"))))
Run Code Online (Sandbox Code Playgroud)

两个单元格是Monk和Summoner.任何帮助,将不胜感激

编辑:是一个示例电子表格.

Ada*_*amL 10

至少有两个问题:

  1. OR不能在数组表达式中的数组上迭代; 你需要使用+操作数.

  2. 如果没有输出,FILTER将返回#N/A,并且COUNTA将此错误值计为1.因此,当预期为0时,您得到1; 使用IFERROR来解释这一点.

=COUNTA(IFERROR(FILTER(I:I,(I:I="Warrior")+(I:I="Paladin"))))

=COUNTA(IFERROR(FILTER(I:I,(I:I="Scholar")+(I:I="White Mage"))))

=COUNTA(IFERROR(FILTER(I:I,I:I<>"Warrior",I:I<>"Paladin",I:I<>"Scholar",I:I<>"White Mage")))

替代第一和第三个更容易扩展的公式:

=COUNTA(IFERROR(FILTER(I:I,MATCH(I:I,{"Warrior";"Paladin"},0))))

=COUNTA(IFERROR(FILTER(I:I,ISERROR(MATCH(I:I,{"Warrior";"Paladin";"Scholar";"White Mage"},0)))))