# From VLOOKUP to XLOOKUP: Upgrading Your Excel Skills

XLOOKUP is a versatile and powerful function in Microsoft Excel that enables users to search for a specific value in a range of cells and return a corresponding value from another range of cells. The function has been introduced in recent versions of Excel, and it offers significant advantages over the more traditional VLOOKUP function, which has been used for many years to perform similar operations.

The basic syntax of the XLOOKUP function is as follows:

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

- lookup_value: the value that you want to look up in the lookup_array.
- lookup_array: the range of cells that contains the values to be searched.
- return_array: the range of cells from which the corresponding value should be returned.
- if_not_found: the value to be returned if the lookup_value is not found. This is an optional argument, and if omitted, XLOOKUP will return an #N/A error.
- match_mode: a numeric value that determines the type of match to be performed. It can be set to 0 for an exact match, 1 for an approximate match, or -1 for a wildcard match. This is an optional argument, and if omitted, XLOOKUP will use an exact match by default.
- search_mode: a numeric value that determines the direction in which to search for the lookup_value. It can be set to 1 for a search from the beginning to end of the lookup_array, or -1 for a search from the end to beginning of the lookup_array. This is an optional argument, and if omitted, XLOOKUP will use a search from the beginning to end by default.

Here is a simple example of how to use the XLOOKUP function in Excel:

Suppose you have a list of employees in an Excel worksheet, and you want to look up the salary of a specific employee based on their name. The employee names are in column A, and their corresponding salaries are in column B.

To perform the lookup using XLOOKUP, you would do the following:

- In an empty cell, enter the XLOOKUP function: =XLOOKUP(“John”, A1:A10, B1:B10)This function will search for the name “John” in the range A1:A10 and return the corresponding salary from column B.
- Press Enter to complete the function. The result should be the salary of the employee named John.If John’s name is not in the list, XLOOKUP will return an error message. However, you can use the optional “if_not_found” argument to specify a value to be returned in case the lookup value is not found.

One of the most significant advantages of XLOOKUP over VLOOKUP is its flexibility. XLOOKUP allows users to perform exact, approximate, or wildcard matches, depending on their needs. This is achieved by using the “match_mode” argument, which can be set to 0 for an exact match, 1 for an approximate match, or -1 for a wildcard match. With this added flexibility, users can search for values that may not be an exact match, but are similar to the value they are looking for. This is particularly useful when working with data that may have some degree of variability or errors.

Another advantage of XLOOKUP is that it enables users to search for values in either direction. The “search_mode” argument can be set to 1 for a search from the beginning to the end of the lookup_array, or -1 for a search from the end to the beginning of the lookup_array. This feature is particularly useful when working with large datasets, as it can help users find the data they need more quickly and efficiently.

XLOOKUP also offers improved error handling compared to VLOOKUP. In the past, when VLOOKUP was used, it was common to see the “#N/A” error message when the function failed to find a match. This error could be frustrating for users, as it often required manual intervention to resolve. XLOOKUP, on the other hand, provides an optional “if_not_found” argument that allows users to specify a value to be returned if the lookup_value is not found. This can help to streamline data processing and reduce the potential for errors.

XLOOKUP also provides more flexibility in terms of return values. With VLOOKUP, it was only possible to return a value from a single column. XLOOKUP, on the other hand, allows users to return values from multiple columns, which can be particularly useful when working with complex datasets. Additionally, XLOOKUP can be used to return entire rows or columns, which can help users to quickly extract large amounts of data.

Here is an example of how to use XLOOKUP to return results from multiple columns in Excel:

Suppose you have a list of products with their corresponding prices, discount percentages, and final prices in an Excel worksheet. The product names are in column A, the prices are in column B, the discount percentages are in column C, and the final prices are in column D.

To use XLOOKUP to search for a product and return its price, discount percentage, and final price, you would do the following:

- In an empty cell, enter the XLOOKUP function: =XLOOKUP(“Product A”, A1:A10, B1:D10)This function will search for “Product A” in the range A1:A10 and return the corresponding values from columns B, C, and D.
- Press Enter to complete the function. The result should be a row with the price, discount percentage, and final price of “Product A.”If “Product A” is not in the list, XLOOKUP will return an error message. However, you can use the optional “if_not_found” argument to specify a value to be returned in case the lookup value is not found.

Another significant advantage of XLOOKUP is that it can be used to search for values in non-contiguous ranges. This means that users can search for values in multiple columns or rows, even if they are not adjacent to each other. This feature can be particularly useful when working with large datasets that have been divided into multiple sections.

Here is an example of how to use XLOOKUP to search for a value in two non-contiguous ranges in Excel:

Suppose you have two ranges of data in an Excel worksheet, one in columns A and B, and another in columns D and E. You want to search for a value in both ranges and return the corresponding value from column B if the value is found in the first range, or column E if the value is found in the second range.

To use XLOOKUP to search for the value in both ranges, you would do the following:

- In an empty cell, enter the XLOOKUP function with the UNION operator: =XLOOKUP(“Value to search for”, A1:B10|D1:E10, B1:E10)This function will search for “Value to search for” in the two non-contiguous ranges A1:B10 and D1:E10, and return the corresponding value from either column B or column E, whichever is found.Note that the UNION operator is represented by the “|” character in Excel.
- Press Enter to complete the function. The result should be the value from either column B or column E, depending on where the search value is found.

Overall, XLOOKUP is a powerful and versatile function that provides significant advantages over traditional lookup functions such as VLOOKUP. Its flexibility, error handling, and return value options make it an essential tool for data processing and analysis. Whether you are working with large or small datasets, XLOOKUP can help you to find the data you need quickly and efficiently.