IF function: Returns one value if condition is TRUE and another if FALSE
Note: Syntax: =IF(logical_test, value_if_true, value_if_false)
- Define the logical test (score >= 50)
- Specify value if true ("Pass")
- Specify value if false ("Fail")
- Enter the formula in the cell
Score >= 50
True: "Pass", False: "Fail"
=IF(A2>=50,"Pass","Fail")
The formula =IF(A2>=50,"Pass","Fail") returns "Pass" for scores ≥ 50, "Fail" otherwise
• Logical operators: >, <, >=, <=, =, <> for comparisons
• Text values: Enclose in double quotes
• Cell references: Use absolute ($A$1) or relative (A1) as needed
• Practice Tip: Test with boundary values (49, 50, 51) to ensure accuracy
- =IF(A1>100,"High","Low") - Compare against 100
- =IF(B2<>"","Has Data","Empty") - Check for empty cells
- =IF(C3=TRUE,"Active","Inactive") - Compare boolean values
- Always use quotes for text results in IF statements
- Test boundary conditions to ensure correct logic
- Use F4 to toggle between absolute and relative references
Q: What if I need multiple conditions?
A: Use nested IF statements or combine with AND/OR functions.
Q: How do I compare text values?
A: Use = operator: IF(A1="Apple","Match","No Match")
COUNTIF function: Counts the number of cells that meet a specified criterion
Note: Syntax: =COUNTIF(range, criteria)
- Identify the range to count (A1:A10)
- Define the criteria (">50000")
- Enter the formula to count matching cells
- Verify the result
Select the salary range (B2:B6)
Criteria: ">50000" (greater than 50,000)
=COUNTIF(B2:B6,">50000")
The formula =COUNTIF(B2:B6,">50000") counts 3 employees with salaries > $50,000
• Critical syntax: Criteria must be in quotes when using operators
• Operators: >, <, >=, <=, <>, = for numeric comparisons
• Text criteria: Use wildcards * and ? for partial matches
• Practice Tip: Use COUNTIFS for multiple conditions
- =COUNTIF(A1:A10,"Apple") - Count exact matches
- =COUNTIF(A1:A10,"*pple") - Count with wildcard
- =COUNTIF(A1:A10,">="&B1) - Dynamic criteria
- Always enclose operators in quotes when used alone
- Combine operators with cell references: ">="&B1
- Use COUNTA to count non-empty cells
Q: Can I count multiple conditions?
A: Yes, use COUNTIFS function for multiple criteria.
Q: How do I count empty cells?
A: Use COUNTBLANK(range) or COUNTIF(range,"")
SUMIF function: Adds the values in a range that meet specified criteria
Note: Syntax: =SUMIF(range, criteria, [sum_range])
- Identify the range to evaluate criteria (A1:A10)
- Define the criteria ("North")
- Identify the range to sum (B1:B10)
- Enter the formula
A2:A6 (Region column)
"North"
B2:B6 (Sales column)
=SUMIF(A2:A6,"North",B2:B6)
The formula =SUMIF(A2:A6,"North",B2:B6) sums to $33,000 for North region sales
• Three arguments: range, criteria, sum_range
• Same size: Criteria range and sum range must be same size
• Text criteria: Enclose in quotes
• Practice Tip: Use SUMIFS for multiple conditions
- =SUMIF(A1:A10,">100",B1:B10) - Sum where A>100
- =SUMIF(A1:A10,"<>Complete",C1:C10) - Sum where A≠"Complete"
- =SUMIF(A1:A10,E1,B1:B10) - Reference criteria in cell E1
- Sum range is optional if criteria and sum ranges are the same
- Wildcards work with text: "A*" matches entries starting with A
- Case-insensitive by default
Q: What if I need multiple criteria?
A: Use SUMIFS function: =SUMIFS(sum_range, criteria_range1, criteria1, criteria_range2, criteria2, ...)
Q: Can SUMIF handle dates?
A: Yes! Use date criteria like ">1/1/2023" or reference date cells.
VLOOKUP function: Searches for a value in the first column of a table and returns a value in the same row from a specified column
Note: Syntax: =VLOOKUP(lookup_value, table_array, col_index_num, [range_lookup])
- Identify the lookup value ("PROD-001")
- Define the table array (A2:B10)
- Specify the column index (2 for price column)
- Set range lookup (FALSE for exact match)
"PROD-001" or reference to cell containing it
A2:B5 (Product ID and Price columns)
2 (second column for Price)
FALSE for exact match
The formula =VLOOKUP("PROD-001",A2:B5,2,FALSE) returns $25.99 for PROD-001
• Lookup column: Must be the leftmost column of the table
• Column index: Count starts from the leftmost column of the table
• Exact match: Use FALSE to avoid approximate matches
• Practice Tip: Use INDEX/MATCH for more flexibility
- =VLOOKUP(A1,Sheet2!$A$1:$D$100,3,FALSE) - Cross-sheet lookup
- =VLOOKUP(D1,A:B,2,FALSE) - Lookup in entire columns
- =VLOOKUP(A1,$A$1:$Z$1000,COLUMN(Z1),FALSE) - Dynamic column index
- Always use absolute references for table arrays ($A$1:$B$10)
- Use IFERROR to handle #N/A errors gracefully
- VLOOKUP only searches left-to-right, not right-to-left
Q: What happens if VLOOKUP doesn't find the value?
A: Returns #N/A error. Use IFERROR to handle this: =IFERROR(VLOOKUP(...),"Not Found")
Q: Can VLOOKUP look to the left?
A: No, VLOOKUP only looks right. Use INDEX/MATCH for leftward lookups.
INDEX/MATCH: A flexible lookup combination that finds values in any column or row
Note: Syntax: =INDEX(return_range, MATCH(lookup_value, lookup_range, 0))
- Identify the return range (names column)
- Identify the lookup range (salaries column)
- Define the lookup value (60000)
- Combine INDEX and MATCH functions
A2:A5 (Employee names)
B2:B5 (Salaries)
60000
=INDEX(A2:A5,MATCH(60000,B2:B5,0))
The formula =INDEX(A2:A5,MATCH(60000,B2:B5,0)) returns "Jane Doe"
• Flexibility: Can lookup in any direction, unlike VLOOKUP
• MATCH function: Returns position of match in range
• INDEX function: Returns value at specified position
• Practice Tip: Use 0 for exact match in MATCH function
- =INDEX(C:C,MATCH(A1,A:A,0)) - Return column C value where A=A1
- =INDEX(B1:Z1,MATCH("Month",A1:Z1,0)) - Horizontal lookup
- =INDEX(A:A,MATCH(MAX(B:B),B:B,0)) - Find name for max value
- INDEX/MATCH is more flexible than VLOOKUP
- Can perform leftward lookups that VLOOKUP cannot
- More efficient with large datasets
Q: What's the advantage of INDEX/MATCH over VLOOKUP?
A: INDEX/MATCH can lookup in any direction, handles insertions/deletions better, and is more efficient.
Q: How do I handle multiple matches?
A: MATCH returns the first match. For subsequent matches, use array formulas or AGGREGATE.