How to use XLOOKUP function in Excel
Posted on: 09/22/2021
The XLOOKUP function is one of my absolute favorites in Excel. It allows you to quickly look up various values in one range and return a corresponding value from another range. Unlike VLOOKUP, XLOOKUP looks both ways, and is more versatile and flexible, particularly when you move ranges around or insert new columns and so on. Let's have a look at how the XLOOKUP function works.
I've covered the XLOOKUP function before, so if you want a more detailed review of how powerful this function is, check out my previous article on the XLOOKUP function. You can also watch a XLOOKUP video if you prefer.
How does XLOOKUP work?
The required syntax for the XLOOKUP function is this:
=XLOOKUP(lookup_value, lookup_array, return_array, [if_not_found], [match_mode], [search_mode])
-
You first have to specify what value you are looking for (lookup_value) - either by typing the value in the formula or by selecting it on the spreadsheet.
-
Then you have to select the look up range (lookup_range). This is the range you are searching IN for a match of that look up value
-
The third argument of the XLOOKUP function is what data do you want returned (return_range). You select the range where you want the matching result returned from.
-
The 4th argument in XLOOKUP is optional. Where a valid match is not found, return the [if_not_found] text you supply. If a valid match is not found, and [if_not_found] is missing, #N/A is returned.
-
The 5th argument is optional. Specify the match type: 0 - Exact match. If none found, return #N/A. This is the default. -1 - Exact match. If none found, return the next smaller item. 1 - Exact match. If none found, return the next larger item. Another great feature of XLOOKUP is the default is exact match. With VLOOKUP you have to specifiy exact match.
-
The 6th argument is optional. Specify the search mode to use: 1 - Perform a search starting at the first item. This is the default.
-1 - Perform a reverse search starting at the last item. 2 - Perform a binary search that relies on lookup_array being sorted in ascending order. If not sorted, invalid results will be returned. -2 - Perform a binary search that relies on lookup_array being sorted in descending order. If not sorted, invalid results will be returned.
-
In my example above, I have a list of employees and I want to look up the employee with ID 0001 (cell A2). I make that the first argument of the XLOOKUP function.
-
Then, I select the look up range (the range I am looking in to find the employees). That's the column with all the IDs, the cells in the A6:A17 range. That is my second argument.
-
Finally, I specify the third argument - which range holds the value I want returned? In my case, B6:B17 has the employee names. So I want my XLOOKUP to find the employee by their ID and return their name.
So my formula above would be:
XLOOKUP(A2, A6:A17, B6:B17)
That's very easy.
Why is XLOOKUP so great?
One reason is that, for example if I've defined the XLOOKUP formula and I need to shift cells, insert a new column, for example so that my data moves to the right, notice the formula still holds and the results are the same:
Another reason I like is that, as opposed to the VLOOKUP function which only looks ahead, I can look up to the left or both ways, really, with the XLOOKUP function:
I hope you enjoy this very quick XLOOKUP function tutorial for Excel. I have many more coming, I'm planning on covering most Excel functions in a quick, beginner-friendly fashion with one-two minute tutorials. Check out the video for this tutorial on my channel and here's a playlist with all the one-minute Excel videos so far.
5 Essential Excel Tips Everyone Should Know
Posted on 11/27/2024
Excel is a powerful tool used across various industries, and mastering its features can significantly boost your productivity. In this blog post, we'll explore five essential Excel tips that every user should know.
Excel Focus Cell: Enhancing Active Cell Visibility and Navigation
Posted by Chris Menard on 10/20/2024
Microsoft Excel has introduced an exciting new feature called Focus Cell, designed to improve the visibility of the active cell and enhance navigation within spreadsheets. This powerful tool highlights the current cell's row and column, making it easier to track your position in large datasets.
Excel 7 Easy Tips Everyone Should Know
Posted by Chris Menard on 08/11/2024
Excel is a powerful tool that can significantly enhance productivity when used effectively. Here, we present seven time-saving Excel tips that will help you work more efficiently.
Copilot In Excel: NEW Feature Enables Copilot Use Without a Table
Posted by Chris Menard on 08/10/2024
Copilot in Excel has introduced some exciting new features that are designed to enhance your productivity. Copilot in Excel handles sorting, conditional formatting, pivottables, and asking questions. You can now do this without having a Table.
Essential Excel Keyboard Shortcuts for Selecting Data
Posted by Chris Menard on 06/26/2024
Join me as I guide you through essential keyboard shortcuts to quickly select ranges in Excel. Discover the power of Ctrl, Shift, Home, End, and arrow keys to enhance your productivity. I'll share tips for navigating data efficiently, dealing with blanks, utilizing tables, and selecting large ranges with ease.
Chris Menard
Chris Menard is a Microsoft Trainer (MCT) and works as a full-time Trainer at BakerHostetler - one of the largest law firms in the US. Chris runs a YouTube channel with 900+ technology videos that cover various tools such as Excel, Word, Zoom, Teams, Gmail, Copilot, Google Calendar, and Outlook. To date, the channel has helped over 20 million viewers.
Menard also does 2 to 3 public speaking events yearly, presenting at the Administrative Professional Conference (APC), the EA Ignite Conference, the University of Georgia, and CPA conferences. You can connect with him on LinkedIn at https://chrismenardtraining.com/linkedin or watch his videos on YouTube at https://chrismenardtraining.com/youtube.
Categories