The Google Sheets COUNTIF function is used to count items in a range that match a given condition.
For example, consider the following dataset of customer sales:
This formula counts how many times “John” is found in the range:
=COUNTIF(A2:A11,"John")
This one counts how many times “New York” occurs:
=COUNTIF(B2:B11,"New York")
And this one counts how many sales are over $500:
=COUNTIF(C2:C11,">500")