Skip to content
Free Excel Tutorials
  • Home
  • Excel For Beginners
  • Excel Intermediate
  • Advanced Excel For Experts

Data Analysis

  • Filter Data Based on Date in Excel
  • Conflicting Multiple Conditional Formatting Rules in Excel
  • How to combine 2 or more chart types in a single chart in Excel
  • How to sum a total in multiple Excel tables
  • Understanding Anova in Excel

References

  • Basic INDEX MATCH approximate in Excel
  • MATCH function: Description, Usage, Syntax, Examples and Explanation
  • How to get first column number in range in Excel
  • How to use Excel MMULT Function
  • To count total rows in a range in Excel

Data Validations

  • Excel Data validation must contain specific text
  • Excel Data validation must begin with
  • Excel Data validation number multiple 100
  • Excel Data validation only dates between
  • Excel Data validation date in next 30 days

COUNTIF function: Description, Usage, Syntax, Examples and Explanation

by

What is COUNTIF function in Excel?

COUNTIF function is one of Statistical functions in Microsoft Excel used to count the number of cells that meet a criterion; for example, to count the number of times a particular city appears in a customer list.In its simplest form, COUNTIF says:

  • =COUNTIF(Where do you want to look?, What do you want to look for?)

For example:

  • =COUNTIF(A2:A5,”London”)
  • =COUNTIF(A2:A5,A4)
Syntax

COUNTIF(range, criteria)

Argument name Description
range The group of cells you want to count. Range can contain numbers, arrays, a named range, or references that contain numbers. Blank and text values are ignored.
criteria A number, expression, cell reference, or text string that determines which cells will be counted.

For example, you can use a number like 32, a comparison like “>32”, a cell like B4, or a word like “apples”.

COUNTIF uses only a single criteria. Use COUNTIFS if you want to use multiple criteria.

Examples of COUNTIF function

To use these examples in Excel, copy the data in the table below, and paste it in cell A1 of a new worksheet.

Data Data
apples 32
oranges 54
peaches 75
apples 86
Formula Description
=COUNTIF(A2:A5,”apples”) Counts the number of cells with apples in cells A2 through A5. The result is 2.
=COUNTIF(A2:A5,A4) Counts the number of cells with peaches (the value in A4) in cells A2 through A5. The result is 1.
=COUNTIF(A2:A5,A2)+COUNTIF(A2:A5,A3) Counts the number of apples (the value in A2), and oranges (the value in A3) in cells A2 through A5. The result is 3. This formula uses COUNTIF twice to specify multiple criteria, one criteria per expression. You could also use the COUNTIFSfunction.
=COUNTIF(B2:B5,”>55″) Counts the number of cells with a value greater than 55 in cells B2 through B5. The result is 2.
=COUNTIF(B2:B5,”<>”&B4) Counts the number of cells with a value not equal to 75 in cells B2 through B5. The ampersand (&) merges the comparison operator for not equal to (<>) and the value in B4 to read =COUNTIF(B2:B5,”<>75″). The result is 3.
=COUNTIF(B2:B5,”>=32″)-COUNTIF(B2:B5,”>85″) Counts the number of cells with a value greater than (>) or equal to (=) 32 and less than (<) or equal to (=) 85 in cells B2 through B5. The result is 3.
=COUNTIF(A2:A5,”*”) Counts the number of cells containing any text in cells A2 through A5. The asterisk (*) is used as the wildcard character to match any character. The result is 4.
=COUNTIF(A2:A5,”?????es”) Counts the number of cells that have exactly 7 characters, and end with the letters “es” in cells A2 through A5. The question mark (?) is used as the wildcard character to match individual characters. The result is 2.

Post navigation

Previous Post:

CUBEVALUE function: Description, Usage, Syntax, Examples and Explanation

Next Post:

CLEAN function: Description, Usage, Syntax, Examples and Explanation

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Learn Basic Excel

Ribbon
Workbook
Worksheets
Format Cells
Find & Select
Sort & Filter
Templates
Print
Share
Protect
Keyboard Shortcuts

Categories

  • Charts
  • Data Analysis
  • Data Validation
  • Excel Functions
    • Cube Functions
    • Database Functions
    • Date and Time Functions
    • Engineering Functions
    • Financial Functions
    • Information Functions
    • Logical Functions
    • Lookup and Reference Functions
    • Math and Trig Functions
    • Statistical Functions
    • Text Functions
    • Web Functions
  • Excel VBA
  • Excel Video Tutorials
  • Formatting
  • Grouping
  • Others

Logical Functions

  • How to return blank in place of #DIV/0! error in Excel
  • IFNA function: Description, Usage, Syntax, Examples and Explanation
  • Complete List of Excel Logical Functions, References and Examples
  • How to use Excel TRUE Function
  • IF function: Description, Usage, Syntax, Examples and Explanation

Date Time

  • How to calculate months between dates in Excel
  • Get project midpoint in Excel
  • How to get workdays between dates in Excel
  • How to calculate Quarter of Date in Excel
  • How to calculate Next working/business day in Excel

Grouping

  • Group times into 3 hour buckets in Excel
  • Group arbitrary text values in Excel
  • How to randomly assign data to groups in Excel
  • If cell contains one of many things in Excel
  • How to randomly assign people to groups in Excel

General

  • How to make excel worksheets print on one page?
  • How to fill cell ranges with random number from fixed set of options in Excel
  • Select, Insert, Rename, Move, Delete Worksheets in Excel
  • How to get amount with percentage in Excel
  • Subtotal by color in Excel
© 2025 xlsoffice . All Right Reserved. | Teal Smiles | Abbreviations And Their Meaning