Clear, practical technology insights BSOD Code Lookup · Windows Error Code Lookup · Wi-Fi Troubleshooting · PC Troubleshooting Checklist

How to Use the COUNTIF Function in Excel

Learn how to use COUNTIF Function in Excel, including its purpose, syntax, examples, and common errors, with clear step-by-step guidance.

Table of Contents

This guide explains how to use COUNTIF Function in Excel, including its syntax, required arguments, practical examples, and common errors.

How to Use the COUNTIF Function in Excel screenshot

Description: The function does a count of cells in a data table that meet certain conditions.

Syntax: COUNTIF (range, criteria)

Inside:

- range: Range you want to count, is a required parameter.

- criteria: The condition that identifies a cell or reference to be counted, which is a required parameter.

Attention:

- For conditional strings longer than 255 characters -> the function returns the wrong value.

- When the function refers to a closed cell or sheet -> the function returns the #VALUE! Error value

- For data that is text, enter a value without leading spaces.

For example:

Calculate the total number of items described in the table below:

How to Use the COUNTIF Function in Excel screenshot 2

1. Calculating the total number of items with unit price of 25000.

- In the cell to calculate, enter the formula : = COUNTIF (D6: D10, "= 25000")

How to Use the COUNTIF Function in Excel screenshot 3

- Press Enter -> item number with unit price of 25000 is:

How to Use the COUNTIF Function in Excel screenshot 4

2. Calculate the total number of items as apples.

- In the cell to calculate enter the formula: = COUNTIF (C6: C10, "= Apple *")

How to Use the COUNTIF Function in Excel screenshot 5

- Press Enter -> total number of apple items in the data table is:

How to Use the COUNTIF Function in Excel screenshot 6

3. Calculate the total number of fruit products except apples.

- In the cell to calculate, enter the formula: = COUNTIF (C6: C10, "<> Apple *")

How to Use the COUNTIF Function in Excel screenshot 7

- Press Enter -> total number of fruit items except apples is:

How to Use the COUNTIF Function in Excel screenshot 8

Above are instructions and some specific examples when using the COUNTIF function in Excel.

Good luck!

FAQ

What does the COUNTIF function do in Excel?

The COUNTIF function performs the calculation described in this guide. Use the correct arguments and compatible data types for reliable results.

How do I enter the COUNTIF function correctly?

Start with an equals sign, enter COUNTIF, add the required arguments inside parentheses, and confirm that cell references and separators are correct.

Why does the COUNTIF function return an error?

Common causes include missing arguments, invalid data types, incorrect cell references, unsupported values, or regional separator settings.

Discussion

Reader Comments 0

Sign in with email or Google to join the discussion.