# Test if Value Exists in a Range in Excel & Google Sheets

This tutorial demonstrates how to use the COUNTIF function to determine if a value exists in a range. ## COUNTIF Value Exists in a Range

To test if a value exists in a range, we can use the COUNTIF Function:

The COUNTIF function counts the number of times a condition is met. We can use the COUNTIF function to count the number of times a value appears in a range. If COUNTIF returns greater than 0, that means that value exists. By attaching “>0” to the end of the COUNTIF Function, we test if the function returns >0. If so, the formula returns TRUE (the value exists). You can see above that the formula results in a TRUE statement for the name “Patrick Mitchell. On the other hand, the name “Georgia Smith” and “Patrick Svensen” does not exist in the range \$B\$2:\$B\$31.

You can wrap this formula around an IF Function to output a specific result. For example, if we want to add a “Does not exist” text for names that are not in the list, we can use the following formula: ## COUNTIF Value Exists in a Range Google Sheets

We use the same formula structure in Google Sheets: 