Google spreadsheet countifs not respecting or condition

半城伤御伤魂 提交于 2020-08-10 18:51:25

问题


I have the following formula:

=COUNTIFS(A2:A41, {"CORE", "TRIAL"})

However, the count comes as 7 when it should be 10. There are 7 core and 3 trials. Is there something I am missing? Just for testing, I tried putting TRIAL as first and it counted 3


回答1:


Change your formula to

=sum(ArrayFormula(COUNTIF(A2:A41, {"CORE", "TRIAL"})))

or use

=sumproduct(regexmatch(A2:A41, "CORE|TRIAL"))

If you only want exact matches, use

=sumproduct(regexmatch(A2:A41, "^CORE|TRIAL$"))

See if that helps?



来源:https://stackoverflow.com/questions/63276791/google-spreadsheet-countifs-not-respecting-or-condition

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!