XLOOKUP with default
IntermediateIn inventory work, you’ll often get a list of SKUs that includes old or discontinued items. Instead of returning an error, you can make your lookup return a clean default value.
XLOOKUP can return a fallback result using its optional if_not_found argument:
=XLOOKUP(lookup_value, lookup_array, return_array, "if_not_found")
Your task
You have an item master list in columns A:D (SKU, Product, Category, Unit cost). On the right, there’s a restock list of SKUs in F2:F8.
- In cell G2, use
XLOOKUPto return the Product name for the SKU in F2. - If the SKU isn’t in the item master list, return Discontinued (not an error).
- Fill the formula down through G8.
Tip: Lock the lookup ranges (with $) so the formula copies down cleanly.
Need some help?
Hint 1
XLOOKUP has an optional 4th argument for what to return when nothing is found.
Hint 2
Use the SKU in F2 as the lookup value, look in the SKU column, and return the Product column.
Hint 3
When you fill down, the lookup ranges should stay fixed (add $ to the table ranges).
Answer
Exercise
XLOOKUP with default
IntermediateIn inventory work, you’ll often get a list of SKUs that includes old or discontinued items. Instead of returning an error, you can make your lookup return a clean default value.
XLOOKUP can return a fallback result using its optional if_not_found argument:
=XLOOKUP(lookup_value, lookup_array, return_array, "if_not_found")
Your task
You have an item master list in columns A:D (SKU, Product, Category, Unit cost). On the right, there’s a restock list of SKUs in F2:F8.
- In cell G2, use
XLOOKUPto return the Product name for the SKU in F2. - If the SKU isn’t in the item master list, return Discontinued (not an error).
- Fill the formula down through G8.
Tip: Lock the lookup ranges (with $) so the formula copies down cleanly.
Need some help?
Hint 1
XLOOKUP has an optional 4th argument for what to return when nothing is found.
Hint 2
Use the SKU in F2 as the lookup value, look in the SKU column, and return the Product column.
Hint 3
When you fill down, the lookup ranges should stay fixed (add $ to the table ranges).