Search code examples
google-sheetssumgoogle-sheets-formulacountingcountif

Google sheets, how to count "other" cells that dont match a range


It's simple to count all cells that match a certain value, but how do i could all cells that dont match one of the values within a range?

enter image description here

For example, how do I could cells not equal to red blue or green?

Normally you can do =COUNTIF(A2:A10,B2) to count ones that match a cell, but as you see from the picture it doesn't work with a range.


Solution

  • there are various ways like:

    =COUNTA(A2:A)-SUM(C2:C4)
    

    or:

    =COUNTA(IFNA(FILTER(A2:A, NOT(REGEXMATCH(A2:A, TEXTJOIN("|", 1, B2:B))))))