COUNTIF Function:
The COUNTIF function counts the number of cells in a range that meet a single condition.
Syntax:
=COUNTIF(range, criteria)
- range: The range of cells to count.
- criteria: The condition to meet.
Example:
If you want to count how many students scored more than 50 in a list:
=COUNTIF(B2:B10, ">50")
This will count the number of cells in the range B2where the value is greater than 50.
COUNTIFS Function:
The COUNTIFS function counts the number of cells that meet multiple conditions.
Syntax:
=COUNTIFS(range1, criteria1, range2, criteria2, ...)
- range1: The first range to evaluate.
- criteria1: The first condition.
- range2: The second range to evaluate.
- criteria2: The second condition.
Example:
If you want to count how many students scored more than 50 and also have a status of “Pass”:
=COUNTIFS(B2:B10, ">50", C2:C10, "Pass")
This will count the number of cells in B2with values greater than 50 and in C2with the status “Pass”.
Key Points:
- COUNTIF is used for a single condition.
- COUNTIFS is used for multiple conditions.
- When specifying conditions, use appropriate comparison operators like
>
,<
,=
.
These functions are useful for filtering and counting data based on conditions in Excel.