Just Another Statistics Textbook
  • Report an error
  • Request a clarification
  • Suggest Content

Count and countifs function

  • Welcome
    • About
    • Installing R(Studio)
  • R Basics
    • Types of Scripts
    • R Fundamentals
    • R Logic
  • Statistics Foundations
    • Statistics Basics
    • Scientific Notation
    • Probability (R)
  • Describing Data
    • Central Tendency (R, Python, Excel, JASP)
    • Dispersion (R,Python, Excel, JASP)
  • Distributions
    • Binomial Distribution (R)
    • Normal Distribution
    • Skewness (R,Python)
    • Transforming Data (R)
  • Correlation
    • Correlations (R,Python)
    • Partial Correlations (R,Python)
  • Regressions
    • Simple regression (R)
    • Multiple Regressions (R)
  • General Linear Models
    • General Linear Models and Sum of Squares (R, Python)
    • T-Tests (R, Python incomplete)
    • One Way ANOVA (incomplete)
    • Repeated Measures ANOVAs
    • Mixed ANOVA (incomplete)
    • ANCOVA (incomplete)
  • Categorical
    • Contingency (R)
  • Item analyses
    • Cronbach’s Alpha (R,Python)
  • Multiple testing
    • Family-Wise Error (R)
    • False Discovery Rate(R)
    • FWER, FDR, Positive and Negative effects(R)
  • Permutations
    • Permutations (R)
    • Permutation vs. t tests (incomplete)
  • Excel tutorial
    • Formulas
    • If function
    • Count and countifs function
    • Sum and SumIf
    • Averageifs
    • Anchoring
  • Test yourself
    • All questions
    • Question Maker

On this page

  • Your turn

Count and countifs function

The spreadsheet this worksheet is based on can be downloaded from here. You can find the relevant tab below:

This function allows you to count the number of cells in a selection.

Like all formulas, it begins with an “=” sign.

Let’s use this to count the number of participants you have (even though in this case we already know it is 10). The general formula is:

=count(START:END)

So to calculate the number of participants, we would write:

An important thing to know about count formulas is that they only count cells with numbers in them. So the following would get zero:

If you want to count the number of phone and non-phone users, you can use countifs. This allows you to count how many occurrences there are of a value you are looking for. You can do this for just one column looking for just one value, or multiple columns looking for multiple values.

The general formula if you are just looking for one value in one column:

=countifs(column_1,value_1)

If you wanted to know the number of phone users, you could type:

=countifs(D2:D11,"yes")

However, as there is nothing else in column D, it would be more elegant to refer to the whole column instead:

=countifs(D:D,"yes")

Now if we wanted to calculate how many females had a phone, you could use add a second column and compare a second value to it:

=countifs(D:D,"yes",C:C,"Female")

Your turn

Use countif formulas to calculate the following. Your forumas should get you the same numbers as listed below:

Sex Phones No Phones Total
Females 3 2 5
Males 3 2 5