#conditonalfunctions #COUNTIF #SUMIF #AVERAGEIF #MAXIFS #Excel #GoogleSheets
Conditional functions perform a specific task, but only on cells that satisfy some defined criteria. They are frequently used when constructing more complex queries.
Assume you have the following sales dataset in A1:E11

1️⃣ COUNTIF
Objective:
Count how many sales were made in the South region.
Excel:
=COUNTIF(C2:C11; “South”)
Explanation:
- C2:C11 → range to evaluate
- “South” → criterion
This counts all rows where Region = South.

The same in Google Sheets
=COUNTIF(C2:C11;”South”)

2️⃣ SUMIF
Objective:
Calculate total revenue generated by Alice.
=SUMIF(B2:B11;”Alice”;E2:E11)
Explanation:
- B2:B11 → criteria range
- “Alice” → condition
- E2:E11 → sum range
This adds revenue only where Salesperson = Alice.

3️⃣ AVERAGEIF
Objective:
Find the average revenue for Laptop sales.
=AVERAGEIF(D2:D11;”Laptop”;E2:E11)
Explanation:
- D2:D11 → criteria range
- “Laptop” → condition
- E2:E11 → average range
Returns the average revenue of all Laptop transactions.

4️⃣ MAXIFS
Objective:
Find the maximum revenue generated in the North region by Alice.
=MAXIFS(E2:E11;B2:B11;”Alice”;C2:C11;”North”)
Explanation:
- E2:E11 → max range
- B2:B11, “Alice” → first condition
- C2:C11, “North” → second condition
Returns the highest single revenue value where both conditions are met = 1300.
