Solved

# Use a function as the criteria in the Excel =COUNTIF() function

Posted on 2013-06-04

*Syntax: =COUNTIF(range, criteria)*

Hello,

**How do you insert a function rather than a value for the criteria in the Excel =COUNTIF() function? **

For example, suppose you have a list of the names of cities in the range A2:A100. And suppose you want to count the number of city names in that range which have more than one word.

I realize that you could use the following formula pasted down in column B to identify cities with one or more spaces:

=ISNUMBER(SEARCH(" ",A2))

and then use the column B results as the criteria in the =COUNTIF() function as follows:

=COUNTIF(B2:B100,"TRUE")

However, is there a way to include the desired criteria directly in the =COUNTIF() function so that a second column need not be tied up?

Thanks