Get startedGet started for free

Conditional summary statistics

In Data Analysis in Google Sheeets, you saw how to use COUNTIF() to calculate summary statistics. Here's you'll take it one step further using the related COUNTIFS() function, which lets you pass multiple conditions to it.

Arguments to COUNTIFS() come in pairs: a range of values to filter on, best given as absolute addresses, and a condition. The condition is text consisting of

  1. a value to match, or
  2. a comparison operator (=, <, >=, etc.) and a number.

For example, COUNTIFS(A2:A100, "DataCamp", B2:B100, ">10") counts the number of values where column A matches "DataCamp" and column B is greater than 10.

This exercise is part of the course

Intermediate Google Sheets

View Course

Exercise instructions

  • In cell H2, get the unique Area values using UNIQUE().
  • In column I, use COUNTIF() to get the count of each Area. Pass the data range from A2 to A45 as absolute addresses, and the filter criteria from H2 to H9.
  • In column J, use COUNTIFS() to get the count of each area with more than 20 Swallow-tails. the first two arguments are the same as the previous step, then add a condition for column D to be greater than 20.

Hands-on interactive exercise

Turn theory into action with one of our interactive exercises

Start Exercise