Introduction
Excel lookups become more useful when your data is incomplete, contains partial text, or requires approximate matching. In this chapter, you will practice IFERROR, wildcard characters such as * and ?, and approximate matching with VLOOKUP, XLOOKUP, and MATCH. These practical questions cover employee records, product searches, grading systems, commission rates, tax slabs, and sales data. Lookup with IFERROR Excel Practice Question with Solutions to help you understand the concepts.
Question 1: Handle a Missing Product with IFERROR and VLOOKUP
Problem Statement
Find the price of each product using VLOOKUP. If a product does not exist, display "Product Not Found" instead of #N/A.
Excel Data
| Product ID | Product | Price |
|---|---|---|
| P101 | Keyboard | 850 |
| P102 | Mouse | 550 |
| P103 | Monitor | 12500 |
| P104 | Webcam | 2200 |
| P105 | Headset | 1800 |
Search Data
| Product ID | Price |
|---|---|
| P103 | |
| P109 | |
| P101 | |
| P110 | |
| P105 |
Excel Solution
In B9, enter:
=IFERROR(VLOOKUP(A9,$A$2:$C$6,3,FALSE),"Product Not Found")
Copy the formula down.
Expected Output
| Product ID | Price |
|---|---|
| P103 | 12500 |
| P109 | Product Not Found |
| P101 | 850 |
| P110 | Product Not Found |
| P105 | 1800 |
Concepts Covered
VLOOKUPIFERROR- Exact match
- Handling
#N/A
Question 2: Use XLOOKUP with IFERROR-Style Error Handling
Problem Statement
Find an employee’s department using their Employee ID. If the ID does not exist, display "Employee Not Found".
Excel Data
| Employee ID | Employee | Department |
|---|---|---|
| E101 | Rahul | IT |
| E102 | Priya | HR |
| E103 | Amit | Sales |
| E104 | Neha | Finance |
| E105 | Arjun | IT |
Search Data
| Employee ID | Department |
|---|---|
| E102 | |
| E108 | |
| E104 | |
| E110 | |
| E101 |
Excel Solution
In B9, enter:
=XLOOKUP(A9,$A$2:$A$6,$C$2:$C$6,"Employee Not Found")
Copy the formula down.
Expected Output
| Employee ID | Department |
|---|---|
| E102 | HR |
| E108 | Employee Not Found |
| E104 | Finance |
| E110 | Employee Not Found |
| E101 | IT |
XLOOKUP has its own if_not_found argument, so IFERROR is not required for this particular case.
Question 3: Find Products Using a Wildcard
Problem Statement
Find the first product whose name starts with "Key".
Excel Data
| Product ID | Product | Price |
|---|---|---|
| P101 | Keyboard | 850 |
| P102 | Mouse | 550 |
| P103 | Monitor | 12500 |
| P104 | Webcam | 2200 |
| P105 | Keypad | 700 |
Search Data
| Search Text | Product |
|---|---|
| Key | |
| Web | |
| Mon | |
| Mou | |
| Head |
Excel Solution
Using XLOOKUP, enter:
=XLOOKUP(A9&"*",$B$2:$B$6,$B$2:$B$6,"Not Found",2)
Copy the formula down.
Expected Output
| Search Text | Product |
|---|---|
| Key | Keyboard |
| Web | Webcam |
| Mon | Monitor |
| Mou | Mouse |
| Head | Not Found |
The * wildcard means any number of characters can appear after the search text.
For example:
Key*
can match:
- Keyboard
- Keypad
XLOOKUP returns the first matching result.
Question 4: Search for Text Containing a Specific Word
Problem Statement
Find the first product whose name contains "Pro" anywhere in the product name.
Excel Data
| Product ID | Product |
|---|---|
| P101 | Keyboard Pro |
| P102 | Wireless Mouse |
| P103 | Monitor Pro |
| P104 | Pro Webcam |
| P105 | Gaming Headset |
Search Data
| Search Text | Matching Product |
|---|---|
| Pro | |
| Mouse | |
| Gaming | |
| Wireless | |
| Headset |
Excel Solution
In B9, enter:
=XLOOKUP("*"&A9&"*",$B$2:$B$6,$B$2:$B$6,"Not Found",2)
Copy down.
Expected Output
| Search Text | Matching Product |
|---|---|
| Pro | Keyboard Pro |
| Mouse | Wireless Mouse |
| Gaming | Gaming Headset |
| Wireless | Wireless Mouse |
| Headset | Gaming Headset |
The formula:
"*"&A9&"*"
allows characters to appear before and after the search text.
Question 5: Use the ? Wildcard
Problem Statement
Use the ? wildcard to find product codes where one character can vary.
Excel Data
| Product Code | Product |
|---|---|
| AB101 | Keyboard |
| AB102 | Mouse |
| AB103 | Monitor |
| AC101 | Webcam |
| AC102 | Headset |
Search Data
| Pattern | Product |
|---|---|
| AB10? | |
| AC10? | |
| AB101 | |
| AC102 |
Excel Solution
In B9, enter:
=XLOOKUP(A9,$A$2:$A$6,$B$2:$B$6,"Not Found",2)
Copy down.
Expected Output
| Pattern | Product |
|---|---|
| AB10? | Keyboard |
| AC10? | Webcam |
| AB101 | Keyboard |
| AC102 | Headset |
The ? wildcard represents exactly one character.
For example:
AB10?
can match:
- AB101
- AB102
- AB103
Question 6: Approximate Match for Commission Rates
Problem Statement
A company gives different commission rates based on sales amount.
Find the commission rate for each salesperson.
Commission Table
| Minimum Sales | Commission Rate |
|---|---|
| 0 | 2% |
| 25000 | 3% |
| 50000 | 5% |
| 75000 | 7% |
| 100000 | 10% |
Sales Data
| Salesperson | Sales | Commission Rate |
|---|---|---|
| Rahul | 18000 | |
| Priya | 42000 | |
| Amit | 68000 | |
| Neha | 92000 | |
| Arjun | 125000 |
Excel Solution
In C9, enter:
=VLOOKUP(B9,$A$2:$B$6,2,TRUE)
Copy down.
Expected Output
| Salesperson | Sales | Commission Rate |
|---|---|---|
| Rahul | 18000 | 2% |
| Priya | 42000 | 3% |
| Amit | 68000 | 5% |
| Neha | 92000 | 7% |
| Arjun | 125000 | 10% |
Important
For approximate VLOOKUP, the first column of the lookup table must be sorted in ascending order.
For example:
0
25000
50000
75000
100000
Question 7: Approximate Match for Student Grades
Problem Statement
Assign a grade based on a student’s marks.
Grade Table
| Minimum Marks | Grade |
|---|---|
| 0 | F |
| 40 | D |
| 50 | C |
| 60 | B |
| 75 | A |
| 90 | A+ |
Student Data
| Student | Marks | Grade |
|---|---|---|
| Rahul | 38 | |
| Priya | 54 | |
| Amit | 68 | |
| Neha | 82 | |
| Arjun | 94 |
Excel Solution
In C9, enter:
=VLOOKUP(B9,$A$2:$B$7,2,TRUE)
Copy down.
Expected Output
| Student | Marks | Grade |
|---|---|---|
| Rahul | 38 | F |
| Priya | 54 | C |
| Amit | 68 | B |
| Neha | 82 | A |
| Arjun | 94 | A+ |
Concepts Covered
- Approximate matching
- Grading system
VLOOKUP- Sorted lookup table
Question 8: Approximate MATCH for a Tax Slab
Problem Statement
Find the applicable tax slab based on annual income.
Tax Table
| Minimum Income | Tax Rate |
|---|---|
| 0 | 0% |
| 300000 | 5% |
| 600000 | 10% |
| 900000 | 15% |
| 1200000 | 20% |
Income Data
| Person | Annual Income | Tax Rate |
|---|---|---|
| Rahul | 250000 | |
| Priya | 450000 | |
| Amit | 750000 | |
| Neha | 1000000 | |
| Arjun | 1500000 |
Excel Solution
Use INDEX and approximate MATCH:
=INDEX($B$2:$B$6,MATCH(B9,$A$2:$A$6,1))
Copy down.
Expected Output
| Person | Annual Income | Tax Rate |
|---|---|---|
| Rahul | 250000 | 0% |
| Priya | 450000 | 5% |
| Amit | 750000 | 10% |
| Neha | 1000000 | 15% |
| Arjun | 1500000 | 20% |
The 1 in MATCH finds the largest value that is less than or equal to the lookup value.
Question 9: Approximate XLOOKUP for Delivery Charges
Problem Statement
A delivery company charges different fees based on package weight.
Find the delivery charge for each package.
Delivery Table
| Minimum Weight (kg) | Delivery Charge |
|---|---|
| 0 | 50 |
| 2 | 70 |
| 5 | 100 |
| 10 | 150 |
| 20 | 250 |
Package Data
| Package | Weight | Delivery Charge |
|---|---|---|
| A | 1 | |
| B | 4 | |
| C | 7 | |
| D | 15 | |
| E | 25 |
Excel Solution
In C9, enter:
=XLOOKUP(B9,$A$2:$A$6,$B$2:$B$6,,-1)
Copy down.
Expected Output
| Package | Weight | Delivery Charge |
|---|---|---|
| A | 1 | 50 |
| B | 4 | 70 |
| C | 7 | 100 |
| D | 15 | 150 |
| E | 25 | 250 |
The -1 match mode tells XLOOKUP to find an exact match or the next smaller value.
Question 10: Combine Wildcard Lookup, IFERROR and XLOOKUP
Problem Statement
Create a product search system where the user enters part of a product name.
The formula should:
- Find a product containing the entered text.
- Return its price.
- Display
"Product Not Found"if there is no match.
Excel Data
| Product ID | Product | Category | Price |
|---|---|---|---|
| P101 | Wireless Keyboard | Accessories | 1200 |
| P102 | Wireless Mouse | Accessories | 750 |
| P103 | Gaming Monitor | Display | 15000 |
| P104 | HD Webcam | Accessories | 2500 |
| P105 | Gaming Headset | Audio | 2200 |
Search Data
| Search Text | Price |
|---|---|
| Wireless | |
| Gaming | |
| Webcam | |
| Keyboard | |
| Tablet |
Excel Solution
In B9, enter:
=IFERROR(XLOOKUP("*"&A9&"*",$B$2:$B$6,$D$2:$D$6,"Product Not Found",2),"Product Not Found")
Copy down.
Expected Output
| Search Text | Price |
|---|---|
| Wireless | 1200 |
| Gaming | 15000 |
| Webcam | 2500 |
| Keyboard | 1200 |
| Tablet | Product Not Found |
Concepts Covered
XLOOKUP- Wildcard search
*wildcardIFERROR- Partial-text lookup
- Error handling
- Practical product search
Key Takeaways
IFERRORcan replace lookup errors with a useful message.XLOOKUPhas anif_not_foundargument, soIFERRORis not always necessary.- The
*wildcard represents zero or more characters. - The
?wildcard represents exactly one character. - Wildcards are useful when you know only part of a text value.
VLOOKUP(...,TRUE)can perform approximate matching.- Approximate lookup tables must be sorted correctly.
MATCH(...,1)can perform approximate matching when the lookup table is sorted in ascending order.XLOOKUPcan use-1to find an exact match or the next smaller value.- Approximate matching is useful for grades, commissions, tax slabs, delivery charges, discounts, and pricing tiers.
- Wildcard lookup is useful for product searches, customer searches, employee names, and partially known text.
FAQs
1. What is a wildcard in Excel?
A wildcard is a special character that allows Excel to search for patterns instead of requiring an exact text match.
The two main wildcards are:
*
?
2. What does * mean in Excel?
* represents any number of characters.
For example:
"*phone*"
can find text containing "phone" anywhere in the cell.
3. What does ? mean in Excel?
? represents exactly one character.
For example:
AB10?
can match:
AB101
AB102
AB103
4. What is approximate matching in Excel?
Approximate matching finds the closest applicable value instead of requiring an exact match.
For example, a sales amount of ₹68,000 can fall into the ₹50,000 commission slab.
5. When should I use approximate VLOOKUP?
Approximate VLOOKUP is useful when you have ranges or slabs such as:
- Marks and grades
- Sales and commissions
- Income and tax rates
- Weight and delivery charges
- Purchase amount and discounts
6. Does approximate VLOOKUP require sorted data?
Yes. When using:
=VLOOKUP(A2,table,2,TRUE)
the first column of the lookup table should normally be sorted in ascending order.
7. What is approximate MATCH?
Approximate MATCH can find the position of the largest value that is less than or equal to the lookup value when using:
=MATCH(A2,B2:B10,1)
The lookup range needs to be sorted in ascending order.
8. Can XLOOKUP use wildcards?
Yes. With the appropriate match mode, XLOOKUP can perform wildcard matching.
For example:
=XLOOKUP("*"&A2&"*",B2:B10,C2:C10,"Not Found",2)
9. What is the difference between * and ??
* can represent zero, one, or many characters.
? represents exactly one character.
10. Can IFERROR be used with XLOOKUP in Excel?
Yes, although XLOOKUP already provides an if_not_found argument.
For example:
=XLOOKUP(A2,B2:B10,C2:C10,"Not Found")
is often enough to handle a missing lookup value.
Written by Shubhranshu Shekhar, who has trained 20000+ students in coding.
