How To Use the XLOOKUP Function in Excel

XLOOKUP guide
Microsoft Excel functions
Data analysis with Excel
How To Use the XLOOKUP Function in Excel cover image

Microsoft Excel's XLOOKUP function is an effective search tool that lets you locate specific values within a range of cells. It replaces prior lookup functions such as VLOOKUP and addresses a lot of their limitations. This article will provide a step-by-step guide on how to use XLOOKUP effectively.

What is the XLOOKUP Function and How Does It Work?

Excel provides multiple tools for searching through data, including the built-in find and select tool and conditional formatting rules. These characteristics, however, don't make a big difference to your spreadsheet or make it simple to reference data in other formulas. Lookup functions, like XLOOKUP, are especially useful in such instances.

Why We Need LOOKUP Functions

In data analysis, instances frequently emerge where you need to search through data using custom search criteria that change regularly. Data analysts frequently use queries that may be readily customized to acquire specific findings from a dataset.

VLOOKUP and HLOOKUP—Limitations and Solutions

The range of traditional lookup functions, such as HLOOKUP (horizontal lookup) and VLOOKUP (vertical lookup), is limited. Among other limitations, they need to find solutions for searching for data to the left or right of values. To overcome these restrictions, XLOOKUP lets you search for data in rows and columns, both to the left and right of your search value.

The Solution—XLOOKUP

XLOOKUP can handle approximate matches, multiple search values, nested queries, custom error messages, and more. It is available only for Microsoft 365 subscribers but has quickly become a game-changer for both basic and complex data searches.

How Does the XLOOKUP Function Work in Microsoft Excel?

To explain the XLOOKUP function, let's use an example. Imagine an Excel spreadsheet containing a staff list with columns for Employee ID, Name, Email Address, and Job Role.

A dataset like this can be used as a searchable directory in Excel using an XLOOKUP formula. A search value for this formula could be any of the values in these columns.

Basic Syntax of XLOOKUP

The basic syntax for the XLOOKUP function is:

Screenshot 2024-06-05 105326.png
- lookup_value: The value you want to search for.

- lookup_array: The range or array to search.

- return_array: The range or array to return a result from.

- [if_not_found]:(Optional) The value to return if no match is found.

Example Scenario

Consider an Excel spreadsheet with four columns: Employee ID, Name, Email, and Job Role.

Screenshot 2024-06-05 105649.png
You want to find the email address of the employee with ID 103. Here's how to do it using XLOOKUP:

  1. Select an Empty Cell To insert an XLOOKUP function, start by opening the Excel spreadsheet and selecting an empty cell. Click the formula bar on the ribbon to begin editing.
  2. Determine the Search Criteria Start typing the formula in the ribbon bar:
    Screenshot 2024-06-05 105810.png
    - lookup_value: 103

- lookup_array: A2 (range containing Employee IDs)

- return_array: C2 (range containing Email addresses)

This formula will search for the ID 103 in the range A2 and return the corresponding email from the range C2 , which is "jim@example.com."

Optional Arguments

- not_found: If the value is not found, you can specify a custom message or value.

Screenshot 2024-06-05 105856.png
- match_mode: Specify the match type.
Screenshot 2024-06-05 105933.png
- search_mode: Specify the search order.
Screenshot 2024-06-05 105959.png

Advanced Features of XLOOKUP

XLOOKUP offers several advanced features:

1. Returning Multiple Columns

XLOOKUP can return multiple columns of data. Suppose you want both the email and job role for a given employee:

Screenshot 2024-06-05 110018.png
This formula returns the array {"jim@example.com", "Designer"}.

2. Nested XLOOKUP

You can nest XLOOKUP functions for complex queries. For example, finding an employee's job role based on their email:

Screenshot 2024-06-05 110038.png
This formula first finds the Employee ID using the email, then finds the job role using that ID.

Things to Consider Before Using XLOOKUP

- Data Arrangement:

XLOOKUP can search data arranged both horizontally and vertically.

- Error Handling:

Use the not_found argument to handle non-matching results gracefully.

- Range Sizes:

Ensure that lookup_array and return_array are the same size to avoid errors.

- Compatibility:

XLOOKUP is available only in Microsoft 365 and newer versions of Excel.

Step-by-Step Guide to Using XLOOKUP in Excel

Follow these steps to create a formula using XLOOKUP:

1. Select an Empty Cell:

Open your Excel spreadsheet and select an empty cell. 2. Type the Formula:

Begin typing =XLOOKUP( in the formula bar.

3. Insert Lookup Criteria:

Specify the lookup value, lookup array, and return array.

4. Add Optional Arguments:

Include not_found, match_mode, and search_mode if needed.

5. Press Enter:

Close the formula with a closing parenthesis and press Enter to see the result.

Final Thoughts

Excel's XLOOKUP function is a versatile and efficient tool for data analysis. In comparison to standard lookup operations, it offers greater flexibility, streamlines difficult queries, and improves data management work efficiency. You may take full advantage of Excel's features and greatly enhance your data analysis skills by learning how to use XLOOKUP. XLOOKUP is a vital tool for any Excel user or data analyst, regardless of whether they are working with basic lists or complicated datasets.


From the Experts at Code Labs Academy – Your Go-To Online Coding Bootcamp for Future Tech Visionaries.


Career Services background pattern

Career Services

Contact Section background image

Let’s stay in touch

Code Labs Academy © 2024 All rights reserved.