Google Spreadsheet, filter doesn't allow wildcards? How to countif multiple columns with wildcards?

て烟熏妆下的殇ゞ 提交于 2019-12-22 05:33:38

问题


When I do:

B         C
223 herp
223 herp
3   herp
223 derp
223 herp,derp

=countif(C:C, "*herp*")

I correctly get 4.

When I do

=count(filter(B:B, B:B=223, C:C="*herp*"))

I incorrectly get 0. When I remove the "*" wildcard characters, I get 2, which is better, but doesn't get herp,derp.

Does filter not support wildcard characters? If so, how can I count a row only if two of it's columns meet two different criteria which have wildcards?


回答1:


FILTER doesn't support wildcards, no. You need to do something like:

=COUNT(FILTER(B:B,B:B=223,SEARCH("herp",C:C)))

or

=COUNT(FILTER(B:B,B:B=223,REGEXMATCH(C:C,"herp")))

Alternatively, in the new version of Sheets, COUNTIFS is supported:

=COUNTIFS(B:B,223,C:C,"*herp*")



来源:https://stackoverflow.com/questions/21342622/google-spreadsheet-filter-doesnt-allow-wildcards-how-to-countif-multiple-colu

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