#1 Data Analytics Program in India
₹2,499₹1,499Enroll Now
Module 2
6 min

COUNTIF & SUMIF

Count and add numbers based on conditions

COUNTIF & SUMIF - Smart Counting and Adding

Ever needed to count how many students passed? Or add up only the "Food" expenses? These functions do exactly that!

COUNTIF SUMIF Overview


Part 1: COUNTIF - Count Things

COUNTIF counts cells that match your rule.

Formula: =COUNTIF(where_to_look, what_to_find)

COUNTIF Example

Example 1: Count High Scores

You have test scores. How many students scored above 80?

A (Name)B (Score)
John85
Mary72
Bob90
Alice68
Tom88
5 rows

Formula: =COUNTIF(B1:B5, ">80")

Answer: 3 (John-85, Bob-90, Tom-88)

Practice: Count Scores Above 70

Easy

Count how many scores in A1:A5 are greater than 70.

A
B
C
D
E
F
1
2
3
4
5
6

Example 2: Count Text

A (Status)
Done
Pending
Done
Done
4 rows

How many are Done?

=COUNTIF(A1:A4, "Done") → 3

Practice: Count "Yes" Responses

Easy

Count how many cells contain "Yes" in A1:A4.

A
B
C
D
E
F
1
2
3
4
5
6

Important: Use Quotes!

ConditionFormula
Greater than 80=COUNTIF(A:A, ">80")
Equal to 100=COUNTIF(A:A, 100)
Less than 50=COUNTIF(A:A, "<50")
Text "Yes"=COUNTIF(A:A, "Yes")
4 rows

Rule: Put operators like > or < inside quotes!


Part 2: SUMIF - Smart Adding

SUMIF adds numbers only when they match your rule.

Formula: =SUMIF(check_here, rule, add_these)

SUMIF Example

Example: Add Food Expenses

A (Category)B (Amount)
Food100
Transport50
Food80
Food60
4 rows

Add all Food expenses:

=SUMIF(A1:A4, "Food", B1:B4)

Result: 240 (100 + 80 + 60)

Practice: Sum Food Expenses

Easy

Sum the amounts in B1:B4 where category in A1:A4 is "Food".

A
B
C
D
E
F
1
2
3
4
5
6

SUMIF Step by Step

=SUMIF(A1:A4, "Food", B1:B4)

  1. A1:A4 - Look in this column (categories)
  2. "Food" - Find rows that say "Food"
  3. B1:B4 - Add numbers from this column

SUMIF Steps


SUMIF with Numbers

Add sales greater than 1000:

A (Sales)
500
1500
800
2000
4 rows

=SUMIF(A1:A4, ">1000", A1:A4)

Result: 3500 (1500 + 2000)

Practice: Sum Sales Above 100

Easy

Sum the values in A1:A4 that are greater than 100.

A
B
C
D
E
F
1
2
3
4
5
6

Quick Reference

FunctionWhat It DoesExample
COUNTIFCount cells matching rule=COUNTIF(A:A, ">80")
SUMIFAdd cells matching rule=SUMIF(A:A, "Food", B:B)
2 rows

Common Mistakes

WrongRightWhy
=COUNTIF(A:A, >80)=COUNTIF(A:A, ">80")Missing quotes around >80
=SUMIF(B:B, "Food", A:A)=SUMIF(A:A, "Food", B:B)Wrong order - check first, sum second
=COUNTIF(A1:A5, Food)=COUNTIF(A1:A5, "Food")Missing quotes around text
3 rows

Summary

COUNTIF: Counts how many cells match

SUMIF: Adds cells that match

Both need:

  • Where to look
  • What rule to follow
  • (SUMIF also needs: what to add)

These save TONS of time when analyzing data!

SkillsetMaster - AI, Web Development & Data Analytics Courses