# How to Use COUNTIF for True Condition in Google Sheets

By using the COUNTIF function to find TRUE conditions and values in Google Sheets, a business can quickly and easily count the number of times a certain condition, such as “product sold” or “payment received”, is met.

This allows for efficient data analysis and can help inform important business decisions, such as identifying top-selling products or tracking payment trends. Check the following article to grasp the concept of using COUNTIF true in google sheets.

## 4 Examples to Use COUNTIF for True Condition in Google Sheets

In Google Sheets, there are a few ways to use the COUNTIF function to find “True” values in a range of cells. Check the following section to find out.

### 1. Simple Boolean Logic Test

The dataset we have contains information about products and their quantity sold. It also has a column indicating whether the product is currently in stock or not, represented by the values “TRUE” or “FALSE“. To find out how many of the products are in stock, we will use a formula to count the number of times the value “TRUE” appears in the stock column.

Steps:

• Firstly, we will select cell D12.

• Secondly, we will use the following formula to count the TRUE Values.
`=COUNTIF(D5:D9,TRUE)`

• Lastly, pressing ENTER will bring forth the result.

The result of this formula is “3” as we can see in the image provided, indicating that there are three products currently in stock.

### 2. Values with Checkbox

Consider that we have a similar dataset. However, Instead of using TRUE or FALSE values, the dataset now uses checkboxes to identify whether the product is still in stock or not.

We will use the same formula as before to count the number of products that are marked as in stock by checking for true values in the “In Stock” column.

Steps:

• Initially, we will select cell D12.
• Subsequently, we will use the following formula.
`=COUNTIF(D5:D9,TRUE)`
• Ultimately, press ENTER to see the result.

Initially, by examining the image, we can see that the result is 3. This indicates that there are three products currently in stock.

### 3. Check Non-Boolean Text

While working on google sheets, we will come across some situations where there will be non-boolean texts such as True or False. The COUNTIF function can only count cells that have a boolean value, so if the cells in the range contain non-boolean values, the function will not be able to count them.

The True and False values that you see in the image above are text values, not Boolean.

To make the COUNTIF function count the values in the “In Stock” column, we must format the column first. Check the following steps to understand.

Steps:

• First, we need to select the data range of the “In Stock” column.

• Afterward, we will change the data format to Automatic. Therefore, it will convert the non-boolean True or False text into Boolean TRUE or FALSE.

• The resulting dataset looks like this:

• Now, we will select cell D12 to apply the following formula.
`=COUNTIF(D5:D9,TRUE)`

• In the end, press ENTER to see the result.

We can adjust the dataset to make the COUNTIF function count the values in the “In Stock” column by changing the data format from Plain text to Automatic. This will convert non-boolean text into boolean text values and provide an accurate outcome.

### 4. Count 1 (True) or 0 (False) Outputs

We can convert boolean text or checkboxes into numerical values, such as 1 and 0, in Google Sheets using the ARRAYFORMULA function. This allows us to easily use these values in calculations and functions like COUNTIF.

Steps:

• We will begin by creating a new column and labeling it as NUM.
• Afterward, we will select cell E5 and use the following formula.
`=ARRAYFORMULA(--(D5:D9))`
• This formula uses the ARRAYFORMULA function to convert any TRUE or FALSE values in the range D5:D9 to 1 or 0 respectively, by using a double negation () operator.

• Next, in order to count the number of TRUE values, we’ll select cell D12 and input the following formula.
`=COUNTIF(F5:F9,1)`
• Press ENTER to apply.

The formula yields the same result as before, which is 3, indicating that there are three products in stock.

## Conclusion

The COUNTIF function in Google Sheets with the TRUE or FALSE Boolean criteria allows for powerful data analysis in a business setting. With the ability to quickly and easily count the number of times, certain criteria are met. The function’s flexibility and simplicity make it a valuable tool for any business looking to gain insights from its data. For more insight check our website OfficeWheel.

## Related Articles

#### Ishrak Khan

Ishrak Khan is a writer and urban planner born in Dhaka, Bangladesh, one of the largest mega-cities. He is a professional Content Developer closely working with OfficeWheel. He simply likes to enthrall his readers. He loves Football, Nico Robin, Deserts, and Twix. If you like the post, give him a heart on Instagram.

We will be happy to hear your thoughts