COUNTIF

Formulas / COUNTIF
Counts cells that match a criterion.
=COUNTIF(range,criteria)
  • range - the group of cells to count
  • criteria - the number, expression, cell reference, or text string determining which cells to count

Examples

  • =COUNTIF(D5:D12,">100") // returns sales greater than 100

    This example returns the number of sales that are greater than 100.

  • =COUNTIF(B5:B12,"jim") // returns the count of the name "jim"

    This example returns the number of cells in the range B5:B12 that contain the name "jim".

  • =COUNTIF(C5:C12,"ca") // returns the count of state = "ca"

    This example returns the number of cells in the range C5:C12 that contain the state "ca".

  • =COUNTIF(A1:A10,100) // returns the count of cells equal to 100

    This example returns the number of cells in the range A1:A10 that are equal to 100.

  • =COUNTIF(A1:A10,">32") // returns the count of cells greater than 32

    This example returns the number of cells in the range A1:A10 that are greater than 32.

Summary

The COUNTIF function is a statistical function in Sourcetable that counts how many cells meet a criterion.

  • COUNTIF is a Sourcetable function that counts cells containing dates, numbers, and text matching a condition called a criteria.
  • The COUNTIF function is one of the most used Sourcetable functions.
  • COUNTIF can only use a single criterion. Use COUNTIFS if you need to match multiple criteria.
  • COUNTIF only accepts text strings in double quotes (""), whereas COUNTIF only accepts cell references that are not in double quotes ("").
  • COUNTIF accepts wildcard characters like the question mark (?) or asterisk (*) in the criteria argument. Use the tilde character (~) to match literal question marks and asterisks with COUNTIF.
  • Do not use arrays in place of ranges with COUNTIF.
  • Note that COUNTIF will throw a #VALUE! error if you reference cells in other workbooks.


Frequently Asked Questions

What is COUNTIF?
COUNTIF is a statistical function used to count the number of cells that meet a specified criterion.
How does COUNTIF work?
COUNTIF has two arguments - range and criteria. The range argument is the group of cells to count and the criteria argument is the number, expression, cell reference, or text string determining the cells to count.
How many criteria can COUNTIF take?
COUNTIF only takes one criterion.
What if I need to match multiple criteria?
If you need to match multiple criteria, you can use the COUNTIFS function instead of COUNTIF.
Can COUNTIF match strings longer than 255 characters?
No, COUNTIF cannot match strings longer than 255 characters.
How can I match strings longer than 255 characters?
You can use the CONCATENATE function or the concatenation operator (&) to match strings longer than 255 characters with COUNTIF.
What error does COUNTIF throw if it references a separate worksheet?
COUNTIF throws a #VALUE! error if it references a separate worksheet.
Is COUNTIF case-sensitive?
No, COUNTIF is not case-sensitive, so be careful when using COUNTIF with strings that have both upper and lower case characters!
Can I use COUNTIF with wildcard characters?
Yes, you can use wildcard characters like the question mark (?) and asterisk (*) with COUNTIF.
What types of text values does COUNTIF not count?
You cannot count text with leading spaces, trailing spaces, inconsistent quotation marks, or non-printing characters with COUNTIF.

Make Better Decisions
With Data

Analyze data, automate reports and create live dashboards
for all your business applications, without code. Get unlimited access free for 14 days.