How to Use COUNTIF and COUNTIFS Functions in Google Sheets
Google Sheets is a versatile tool that has made our lives way easier than before. When it comes to counting the data, Google Sheets offers two powerful functions called COUNTIF and COUNTIFS. These functions are used to count the number of cells that meet certain conditions.
COUNTIF Function:
The COUNTIF function is used to count the number of cells in a range that meet a specific condition. The syntax of using COUNTIF function is as follows:
=COUNTIF(range, criteria)
Range: The range of cells in which you want to count the cells.
Criteria: The condition or value by which you want to count the cells.
For example, if you want to count the number of cells in the range A1:A6, which contains the value ‘Apple’, the formula would be:
= COUNTIF(A1:A6, “Apple”)
This formula will count all cells in the range A1:A6 that contain the value “Apple”.
COUNTIFS Function:
The COUNTIFS function is used when we have to count the number of cells that meet multiple criteria. The syntax of using the COUNTIFS function is as follows:
=COUNTIFS(range1, criteria1, range2, criteria2,….)
Range1, Range2, …… Range n: The range of cells in which you want to count the cells.
Criteria1, Criteria2, ……. Criteria n: The condition or value by which you want to count the cells
For example, if you want to count the number of cells in the range A1:A6 and B1:B6 that contain the value ‘Apple’, the formula would be:
= COUNTIFS(A1:A6, “Apple”, B1:B6, “Apple”)
This formula will count all cells in the range A1:A6 and B1:B6 that contain the value ‘Apple’.
Using Wildcards:
Wildcards are used to match a specific pattern. There are two types of wildcards – asterisk (*) and question mark (?). The asterisk represents zero or more characters, while the question mark represents a single character.
For example, if you want to count all the cells that contain the word “Banana” in the range A1:A6, the formula would be:
= COUNTIF(A1:A6, “*Banana*”)
This formula will count all cells in the range A1:A6 that contain the word “Banana” anywhere in the cell.