Sometimes when working in spreadsheet programs like Google Sheets, you may want to perform a task, but you may not know the best way to accomplish this.
For example, one common task that many spreadsheet users need to do is to search a range of cells to see if a certain value exists inside the range. That is pretty easy to do with a simple function.
In this tutorial, I will show you how to check if a value exists in a range of cells in Google Sheets.
Check if Value is in Range
Whether you are searching for a text value or numeric value inside a range, the best way to accomplish this task is by using the COUNTIF function.
The COUNTIF function runs a conditional search across a range of cells that will return a count of the number of times a specified value appears in a range.
By using this to search for a value, if the value appears in that range, COUNTIF will return a 1 or greater.
The syntax of COUNTIF is:
=COUNTIF(range, criterion)
- range – this is the range of cells that you are searching for your value in
- criterion – this is the value that you are searching for inside of your range
Here is how this can be used to search for a value inside a range of cells:
You can see in the example above that my formula is searching the range of data that I have in A2:A11 for my criteria in C2. If the value exists, my formula will return a 1. If it does not exist it will return a 0.
With this method, you can search for numbers, text values, and more.
Closing Thoughts
If you need to quickly search a range of cells to see if it contains a specific value, the COUNTIF function is the fastest way to do this.
As a daily spreadsheet user, this is one of the most common functions that I use on a day-to-day basis, so you really take the time to learn how to use this.
More Google Sheets Tutorials:
How to Count Unique Values
Check If Cell Contains Formula
How to Extract Numbers or Text from a String