DAY 9: Excel - Advanced Functions (SUMIFS, COUNTIFS, Text Functions)

Guru Charan Pathalla

DAY 9: Excel - Advanced Functions (SUMIFS, COUNTIFS, Text Functions)

Learning Objectives: - Master multiple criteria functions (SUMIFS, COUNTIFS, AVERAGEIFS) - Use text manipulation functions - Combine functions for complex calculations - Handle errors with IFERROR and IFNA - Build dynamic formulas with array functions

Topics Covered (60 min):

1. Multiple Criteria Functions - SUMIFS(sum_range, criteria_range1, criteria1, [criteria_range2, criteria2]...) - COUNTIFS(criteria_range1, criteria1, [criteria_range2, criteria2]...) - AVERAGEIFS(average_range, criteria_range1, criteria1...) - Example: Sum sales for Region="West" AND Product="Tech" - Can use wildcards: COUNTIFS(A:A, "Tech*")

2. Text Functions - LEFT(text, num_chars), RIGHT(text, num_chars), MID(text, start, num_chars) - LEN(text) - Length of text - UPPER(text), LOWER(text), PROPER(text) - TRIM(text) - Remove extra spaces - CONCATENATE() or & operator or TEXTJOIN() - FIND(), SEARCH(), SUBSTITUTE()

3. Error Handling - IFERROR(value, value_if_error) - Catch all errors - IFNA(value, value_if_na) - Catch #N/A errors specifically - Example: =IFERROR(VLOOKUP(A2, Table, 2, 0), "Not Found") - Clean up division by zero: =IFERROR(A2/B2, 0) - Nested error handling for complex formulas

4. Array Formulas & UNIQUE - UNIQUE(array) - Get unique values - SORT(array, [sort_index], [sort_order]) - FILTER(array, include, [if_empty]) - Dynamic arrays (Excel 365) - Combining functions: =SORT(UNIQUE(A2:A100))

Video Resources:

  1. SUMIFS, COUNTIFS, AVERAGEIFS (15 min)
    https://www.youtube.com/watch?v=YvV7Jinnv-w - Leila Gharani
  2. Excel Text Functions (12 min)
    https://www.youtube.com/watch?v=ZYJHgGp-RL0 - MyOnlineTrainingHub
  3. IFERROR and Error Handling (10 min)
    https://www.youtube.com/watch?v=mGTcBfmL4Ss - Excel Campus
  4. Dynamic Array Functions (18 min)
    https://www.youtube.com/watch?v=9WyFUO_llBc - Leila Gharani

AI Learning Prompts (Concept Understanding Only):

Understanding Multiple Criteria Functions:

I'm learning Excel multiple criteria functions. Please explain:

1. What is the difference between SUMIF and SUMIFS?
2. How do I sum sales where Region="East" AND Category="Technology" AND Sales>1000?
3. Show me how to use wildcards with COUNTIFS
4. Can I use comparison operators (>=, <=) in criteria?
5. Provide examples using sales data with multiple conditions

Use step-by-step examples for beginners.

Understanding Text Functions:

Help me understand Excel text manipulation:

1. How do I extract first name from "John Smith" in cell A1?
2. Show me how to combine first and last name with a space
3. How do I remove extra spaces and convert to proper case?
4. Explain FIND vs SEARCH functions
5. Provide examples for cleaning messy text data

Explain with practical data cleaning scenarios.

Understanding Error Handling:

I'm learning error handling in Excel. Please explain:

1. What types of errors occur in Excel (#N/A, #DIV/0!, #VALUE!, etc.)?
2. When should I use IFERROR vs IFNA?
3. Show me how to handle VLOOKUP errors gracefully
4. How do I prevent division by zero errors?
5. Provide examples of nested error handling

Use practical examples with formulas.

Guided Practice (60 min):

📝 How to approach Guided Practice:

  • Follow step-by-step: Work through each exercise in order
  • Use provided resources: Reference the video tutorials and AI prompts if you get stuck
  • Verify your work: Check your results match expected outcomes
  • Take notes: Document key learnings and shortcuts you discover
  • Ask for help: Use AI assistants to clarify concepts you don't understand

Using Superstore Sales dataset - Excel Practice

📝 Setup Instructions:

  1. Open your Superstore Sales dataset
  2. Ensure columns: Region, Category, Sales, Profit, Product Name, Customer Name, etc.
  3. Today builds on Day 3 (SUMIF/COUNTIF) - now with MULTIPLE criteria!

💡 Advanced Functions: Day 3 taught SUMIF (one condition). Today you'll master SUMIFS, COUNTIFS, AVERAGEIFS (multiple conditions) plus text manipulation!

Exercise 1: SUMIFS - Sum with Multiple Criteria

Step-by-Step Instructions:

  1. Calculate total sales for West region AND Technology category
  2. In an empty cell, type:
    =SUMIFS(D:D, C:C, "West", E:E, "Technology")
    Breaking it down:
    • D:D = Sum range (Sales column)
    • C:C, "West" = First criteria: Region = West
    • E:E, "Technology" = Second criteria: Category = Technology
  3. Press Enter
  4. Try more combinations:
    =SUMIFS(D:D, C:C, "East", F:F, ">500")
    Sum sales for East region where Sales > 500

💡 SUMIFS vs SUMIF:

  • SUMIF: One condition - =SUMIF(range, criteria, sum_range)
  • SUMIFS: Multiple conditions - =SUMIFS(sum_range, criteria_range1, criteria1, criteria_range2, criteria2...)
  • Note: SUMIFS puts sum_range FIRST!

✅ Expected Result: Total sales matching ALL specified criteria

Exercise 2: COUNTIFS & AVERAGEIFS - More Multi-Criteria Functions

Step-by-Step Instructions:

  1. COUNTIFS - Count rows meeting multiple conditions:
    =COUNTIFS(C:C, "West", D:D, ">1000")
    Counts West region orders with Sales > 1000
  2. AVERAGEIFS - Average with multiple criteria:
    =AVERAGEIFS(I:I, C:C, "East", D:D, ">0")
    Average profit for East region where Sales > 0
  3. Three criteria example:
    =SUMIFS(D:D, C:C, "West", E:E, "Furniture", I:I, ">0")
    Sum West + Furniture + Profitable orders

💡 Pattern Recognition:

  • All end with "IFS" for multiple criteria
  • Format: =XXXIFS(value_range, criteria_range1, criteria1, criteria_range2, criteria2...)
  • Can have many criteria pairs (not limited to 2!)

✅ Expected Result: Counts and averages based on multiple conditions

Exercise 3: Text Functions - Extract and Manipulate

Step-by-Step Instructions:

  1. LEFT, RIGHT, MID - Extract parts of text:
    =LEFT(A2, 3)  // First 3 characters
    =RIGHT(A2, 4)  // Last 4 characters
    =MID(A2, 2, 5)  // 5 characters starting at position 2
  2. CONCATENATE or & - Combine text:
    =B2 & "-" & C2 & "-" & D2  // Join with hyphens
    =CONCATENATE(B2, " ", C2)  // Join with space
  3. UPPER, LOWER, PROPER - Change case:
    =UPPER(A2)  // ALL CAPS
    =LOWER(A2)  // all lowercase
    =PROPER(A2)  // Title Case
  4. TRIM - Remove extra spaces:
    =TRIM(A2)  // Removes leading/trailing/extra spaces
  5. LEN - Count characters:
    =LEN(A2)  // Number of characters

💡 Practical Example - Create Product Code:

=UPPER(LEFT(B2,3)) & "-" & C2

This takes first 3 letters of product name (uppercase) + hyphen + category

✅ Expected Result: Extracted, combined, or formatted text as needed

Exercise 4: IFERROR - Handle Errors Gracefully

Step-by-Step Instructions:

  1. Basic IFERROR with division:
    =IFERROR(I2/D2, 0)
    Calculates Profit/Sales; if error (division by zero), returns 0
  2. IFERROR with VLOOKUP (from Day 5):
    =IFERROR(VLOOKUP(A2, Products!A:C, 2, FALSE), "Not Found")
    If product not found, shows "Not Found" instead of #N/A
  3. Nested error handling:
    =IFERROR(I2/D2, IFERROR(I2/E2, "No Data"))
    Try first calculation; if error, try second; if still error, show "No Data"

💡 Common Errors Handled:

  • #DIV/0! - Division by zero
  • #N/A - VLOOKUP/XLOOKUP not found
  • #VALUE! - Wrong data type
  • #REF! - Invalid cell reference

✅ Expected Result: Clean output with user-friendly messages instead of error codes

Exercise 5: Combining Advanced Functions - Real-World Example

Step-by-Step Instructions:

  1. Create a dashboard cell showing: "West region Technology sales for profitable orders"
  2. Use this formula:
    =IFERROR(
      "West Tech Profitable Sales: $" &
      TEXT(SUMIFS(D:D, C:C, "West", E:E, "Technology", I:I, ">0"), "#,##0"),
      "Data Not Available"
    )
    Breaking it down:
    • SUMIFS calculates the sum (multiple criteria)
    • TEXT formats the number with commas
    • & concatenates the label and value
    • IFERROR handles any errors
  3. Result looks like: "West Tech Profitable Sales: $125,450"

🎯 Function Nesting:

  • You can nest functions inside each other
  • Excel evaluates from inside out
  • Combine multiple functions for powerful calculations
  • Always test each part separately first!

✅ Expected Result: Professional-looking formatted output combining multiple advanced functions

🎯 Practice Goal Checkpoint:

By completing these 5 exercises, you should now be able to:

  • Use SUMIFS, COUNTIFS, AVERAGEIFS for multiple criteria
  • Manipulate text with LEFT, RIGHT, MID, CONCATENATE, UPPER/LOWER/PROPER, TRIM
  • Handle errors gracefully with IFERROR
  • Combine multiple functions in complex formulas
  • Create professional, formatted outputs

Key Insight: Advanced functions eliminate manual work! Instead of filtering data repeatedly, one formula can calculate exactly what you need across any criteria.

Comparison with Previous Days:

  • Day 3: SUMIF (one condition)
  • Day 9: SUMIFS (multiple conditions) + text manipulation + error handling
  • Building complexity step by step!

Common Use Cases:

  • Complex reports with multiple filters
  • Data cleaning and standardization
  • Dashboard calculations
  • Automated data processing

Take a 5-minute break, then move on to Independent Practice!

Independent Practice (60 min):

💡 Hints for Independent Practice:

  • Start simple: Begin with basic variations before attempting complex modifications
  • Break it down: Divide complex problems into smaller, manageable steps
  • Test incrementally: Verify each step works before moving to the next
  • Use documentation: Refer to official docs or tutorials when needed
  • Experiment: Try different approaches to find what works best

Challenge 1: Sales Analysis Dashboard - Calculate sales by multiple criteria (Region + Category + Year) - Count orders meeting various conditions - Use text functions to create product hierarchies - Add error handling to all formulas - Create summary with UNIQUE and SORT

Challenge 2: Data Cleaning Project - Clean customer names (trim, proper case) - Extract components from address field - Standardize phone number format - Remove duplicates and create clean list - Handle missing data with IFERROR

Daily Assignment (60 min):

Assignment: Advanced Sales Report with Data Cleaning

Create a comprehensive report with:

- Total sales by Region AND Category (use SUMIFS)

- Count of orders by multiple conditions (COUNTIFS)

- Average order value by segment (AVERAGEIFS)

- Sales for products containing specific keywords

- Split customer names into first/last

- Create standardized product codes

- Clean and format addresses

- Extract useful information from combined fields

- Wrap all lookups in IFERROR

- Handle division by zero in all calculations

- Provide meaningful error messages

- Test with missing/invalid data

- Create sorted list of unique customers

- Filter top products by sales

- Generate dynamic category summaries

Requirements: - Use at least 5 different SUMIFS/COUNTIFS formulas - Apply 5+ text functions for data cleaning - Implement IFERROR on all formulas - Use UNIQUE and SORT for dynamic lists - Format professionally with clear labels

Expected Outcomes:


📝 Day 9 Quick Quiz - Test Your Knowledge!

Q1. What does SUMIFS do differently than SUMIF?

Q2. In SUMIFS, what comes first in the syntax?

Q3. What does COUNTIFS count?

Q4. Which function converts text to uppercase?

Q5. What does LEFT(A1, 3) return when A1 contains 'Hello'?