CountIF and CountIFS


Using COUNTIF and COUNTIFS Functions in Excel

📌 Overview

- COUNTIF: Counts the number of cells that meet a single condition.
- COUNTIFS: Counts the number of cells that meet multiple conditions.

🧮 1. COUNTIF Function

🔹 Syntax:

COUNTIF(range, criteria)

🔹 Parameters:

- range: The range of cells you want to apply the criteria to.
- criteria: The condition that determines which cells to count.

🔹 Step-by-Step Example:

Data (A1:A7):
Apple
Banana
Apple
Orange
Apple
Banana
Grapes

Goal: Count how many times 'Apple' appears.

🪜 Steps:

1. Click on the cell where you want the result (say B1).
2. Type the formula:
   =COUNTIF(A1:A7, "Apple")
3. Press Enter.

Result: 3 (since "Apple" appears 3 times)

🧮 2. COUNTIFS Function

🔹 Syntax:

COUNTIFS(criteria_range1, criteria1, [criteria_range2, criteria2], ...)

🔹 Parameters:

- criteria_range1: The first range to evaluate.
- criteria1: The condition for the first range.
- Add as many pairs of criteria range and criteria as needed.

🔹 Step-by-Step Example:

Data Table:
| Product | Region | Sales |
|---------|--------|-------|
| Apple  | East   | 50    |
| Banana | West   | 60    |
| Apple  | East   | 70    |
| Apple  | West   | 30    |
| Banana | East   | 90    |

Goal: Count how many 'Apple' sales were in the 'East' region.

🪜 Steps:

1. Click on the result cell (e.g., D1).
2. Enter the formula:
   =COUNTIFS(A1:A5, "Apple", B1:B5, "East")
3. Press Enter.

Result: 2 (since "Apple" appears in "East" twice)

🔍 Notes:

👉 Wildcards in Criteria:

- ? = any single character
- * = any number of characters
- Example: =COUNTIF(A1:A10, "App*") — counts values starting with "App"

👉 Use of Cell References:

Instead of hardcoding criteria:
=COUNTIF(A1:A7, C1)  // if C1 contains "Apple"

📘 Bonus: Using Operators

- Greater than 50: =COUNTIF(C1:C10, ">50")
- Not equal to "Apple": =COUNTIF(A1:A7, "<>Apple")