# COUNTIF with function in criterion

I'd like to count all cells in a range where a given function evaluates to TRUE. The documentation for `COUNTIF` & `COUNTIFS` show text-matching and evaluation of `=`,`<>`,`<`,`>`, but nothing more sophisticated.

Here's an example with the function `ISDATE` (could be any TRUE/FALSE function) as a sheet or as a table:

A B
1 7/28/2021 <- is a date
2 12/7/1941 <- is a date
3 =TODAY() <- is a date
4 foobar <- is not a date
5 <- is not a date
6 =COUNTIF(A1:A5, "=ISDATE()") <- should evaluate to 3

Is something like that possible?

• I know I could accomplish this with an `ISDATE` helper column. I'd like to understand what's possible within the `COUNTIF` condition specifically. (In the real spreadsheet in question, I don't have permissions to add a column.) Jul 30, 2021 at 1:04
• It's not possible seeing as that goes against the syntax for criterion support.google.com/docs/answer/3093480?hl=en. "criterion must be a string" Jul 30, 2021 at 21:59

Change `=COUNTIF(A1:A5, "=ISDATE()")` to `=COUNTIF(B1:B5, TRUE)`
This will count how many `ISDATE` function calls in column B have evaluated to TRUE. Instead of what you were doing which was counting how many times the string `=ISDATE()` appears in the first 5 cells of column A.
• Thanks, but I'm specifically interested in the form of the `COUNTIF` condition argument. Jul 30, 2021 at 1:07
• Column B `=ISDATE(A1)`
• B6 `=COUNTIF(B1:B5,TRUE)`
• Thanks, but I'm specifically interested in the form of the `COUNTIF` condition argument. Jul 30, 2021 at 1:08