Spreadsheets help you quickly filter and analyze data. One quick way to find data matching a specific condition is the COUNTIF function. Let’s learn how to use the COUNTIF function in Microsoft Excel.
How to Use the COUNTIF Function in Excel
Imagine that you have a range of data, and you need to know how many cells contain data matching a certain condition. For example, consider a list of student names and test scores. You might want to know how many students scored 90 or better and made an “A” grade.
Of course, you could count manually, but that gets difficult with large datasets. The COUNTIF function does the work for you.
Begin by clicking into any empty cell in your worksheet. Go ahead and type an = sign. That tells Excel that you’ll be inputting a formula. Continue by typing COUNTIF, then (. So far, your formula reads:
=COUNTIF(
The COUNTIF formula always asks for two inputs. These are the range and the criteria. The range refers to the data that you want the formula to count from. The easiest way to add it to your formula is to click and drag to select the cells containing test scores. Here, that’s B2:B6. Once you’ve done that, add a comma. The formula is now:
=COUNTIF(B2:B6,
The condition is how you tell Excel how to filter the count. Remember, we want 90 or greater here. Ensuring you type the quotation marks, enter:
">=90")
Your finished formula is:
=COUNTIF(B2:B6,">=90")
Hit Enter on your keyboard, and Excel returns your solution: 3.
COUNTIF works with a variety of conditions. For example, you can search for cells equalling a certain number, or even containing a certain word. This is a great way to save time and quickly process large volumes of data, to find certain cells that contain a given condition. It’s easy to do in Excel.