COUNTIF & COUNTIFS in Excel

Learn how to use COUNTIF & COUNTIFS in Excel with real-life examples. This guide explains both functions in simple words to help you count data based on conditions.


What is COUNTIF?

COUNTIF counts how many cells meet a single condition.

Syntax:

=COUNTIF(range, criteria)

  • range: The group of cells you want to check
  • criteria: The rule or condition you want to apply

Example 1: Count How Many Students Passed

NameMarks
Aditi55
Rohan42
Tina38
Aryan71

👉 Count how many scored 40 or more (i.e., passed).

=COUNTIF(B2:B5, ">=40")

👉 Result: 3 students passed.


Example 2: Count How Many Apples Sold

ProductQuantity
Apple20
Banana15
Apple30
Mango10

=COUNTIF(A2:A5, "Apple")

👉 Result: 2 rows have “Apple”.


Example 3: Calculate Average Sales Only If Apple Sold

ProductQuantity
Apple20
Banana15
Apple30
Mango10

👉 Only calculate average if Apple was sold:

=IF(COUNTIF(A2:A5, "Apple") > 0, AVERAGE(B2:B5), "Apple not sold")

👉 Result: 18.75

What is COUNTIFS?

COUNTIFS lets you count cells only if multiple conditions are true.

Syntax:

=COUNTIFS(range1, criteria1, range2, criteria2, ...)

Note: Each pair checks a new condition.


Example 4: Count Female Employees in HR

NameGenderDepartment
NehaFemaleHR
AmanMaleSales
PriyaFemaleHR
RaviMaleHR

=COUNTIFS(B2:B5, "Female", C2:C5, "HR")

👉 Result: 2


Example 5: Count Orders Above ₹5000 from Delhi

CityOrder Amount
Delhi₹7000
Mumbai₹4000
Delhi₹3000
Delhi₹8000

=COUNTIFS(A2:A5, "Delhi", B2:B5, ">5000")

👉 Result: 2 orders from Delhi above ₹5000


Example 6: Count Attendance in January

DatePresent
01-Jan-24Yes
15-Jan-24No
31-Jan-24Yes
02-Feb-24Yes

👉 Count how many “Yes” in January only:

=COUNTIFS(A2:A5, ">=01-Jan-2024", A2:A5, "<=31-Jan-2024", B2:B5, "Yes")

👉 Result: 2 present in Jan.



When to Use COUNTIF or COUNTIFS?

ScenarioUse
Count based on 1 conditionCOUNTIF
Count based on 2 or more rulesCOUNTIFS

Final Thoughts

  • Use COUNTIF for quick filtering like “How many Apples?” or “How many passed?”
  • Use COUNTIFS when you want extra control, like counting based on 2 or more rules (e.g., region + amount + status).
  • These are perfect for reports, dashboards, attendance sheets, and more.

What’s Next?

In the next post, we’ll learn about the AVERAGEIF & AVERAGEIFS in Excel

Spread the love

Leave a Comment

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

Translate »
Scroll to Top