How to Use the XLOOKUP Function in Excel

Today, let’s dive into the capabilities of a powerful Excel and Google Sheets function known as XLOOKUP. XLOOKUP is designed to search through a range or array and returns the corresponding item from the first match it finds. This function serves as a modern replacement for older functions like VLOOKUP, HLOOKUP, and LOOKUP, providing greater flexibility and user-friendliness.

Basic Syntax

The fundamental syntax of the XLOOKUP function is:

XLOOKUP(lookup_value, lookup_array, return_array, [if_not_found], [match_mode], [search_mode])

Here’s a detailed explanation of the parameters:

  • lookup_value: The value you are searching for.
  • lookup_array: The array or range to perform the search in.
  • return_array: The array or range from which to retrieve the result.
  • if_not_found (optional): Specifies a value to return if the search does not find a match.
  • match_mode (optional): This can be set to 0 for an exact match, -1 for an exact match or the next smaller item, or 1 for an exact match or the next larger item.
  • search_mode (optional): Designates the search order; 1 for searching from first to last, -1 for last to first, or 2 for a binary search.

Example 1: Simple XLOOKUP

Consider a list of employees and their respective salaries. We need to find the salary of an employee named John using XLOOKUP.

Employee Salary
John 50000
Alice 60000
Bob 45000

Formula: =XLOOKUP("John", A2:A4, B2:B4)

This formula successfully returns John’s salary as $50,000.

Example 2: XLOOKUP with Default Value

If a search doesn’t yield a result, you can set a default return value. Let’s update our previous example for an employee named David:

Formula: =XLOOKUP("David", A2:A4, B2:B4, "Not found")

This formula will return “Not found” as David is not listed among the employees.

Example 3: Using XLOOKUP with Match Modes

You can fine-tune the behavior of your XLOOKUP query with match modes. Suppose we want to find the closest salary to a certain amount not present in our array:

Formula: =XLOOKUP(55000, B2:B4, A2:A4, , 1)

This query returns “Alice” because $55,000 falls between John’s and Alice’s salaries, making hers the next higher match.

Conclusion

XLOOKUP greatly simplifies the process of searching for and retrieving data in Excel and Google Sheets. With its flexible and powerful options, it can accommodate a variety of lookup scenarios with ease, significantly enhancing data manipulation and retrieval tasks.

More information: https://support.microsoft.com/en-us/office/xlookup-function-b7fd680e-6d10-43e6-84f9-88eae8bf5929

Other functions
Returns a reference as text to a single cell in a worksheet
Returns the number of areas in a reference
Chooses a value from a list of values
Returns the column number of a reference
Returns the number of columns in a reference
Filters a range of data based on criteria you define
Returns the formula at the given reference as text
Returns data stored in a PivotTable report
Looks in the top row of an array and returns the value of the indicated cell
Creates a shortcut or jump that opens a document stored on a network server, an intranet, or the Internet
Uses an index to choose a value from a reference or array
Returns a reference indicated by a text value
Looks up values in a vector or array
Looks up values in a reference or array
Returns a reference offset from a given reference
Returns the row number of a reference
Returns the number of rows in a reference
Retrieves real-time data from a program that supports COM automation
Sorts the contents of a range or array
Sorts the contents of a range or array based on the values in a corresponding range or array
Returns the transpose of an array
Returns a list of unique values in a list or range
Looks in the first column of an array and moves across the row to return the value of a cell
Returns the relative position of an item in an array or range of cells