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
- a value to match, or
- 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.
Bài tập này là một phần của khóa học
Google Sheets nâng cao
Hướng dẫn bài tập
- In cell
H2, get the unique Area values usingUNIQUE(). - In column
I, useCOUNTIF()to get the count of each Area. Pass the data range fromA2toA45as absolute addresses, and the filter criteria fromH2toH9. - In column
J, useCOUNTIFS()to get the count of each area with more than20Swallow-tails. the first two arguments are the same as the previous step, then add a condition for columnDto be greater than20.
Bài tập tương tác thực hành
Biến lý thuyết thành hành động với một trong các bài tập tương tác của chúng tôi
Bắt đầu bài tập