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

19,126

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*")

Share:
19,126
Anikeev Gennadiy
Author by

Anikeev Gennadiy

I have to deal with a wide variety of different technologies, often ones I have no context for understanding, so I tend to post here a lot about a lot of different topics (Rails, Blackberry/Android development, SQL, OpenLayers, and Raphael are a few examples).

Updated on July 31, 2022

Comments

  • Anikeev Gennadiy
    Anikeev Gennadiy almost 2 years

    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?