XLOOKUP function - Microsoft Support (2024)

Table of Contents
Syntax Examples See also References

Use the XLOOKUP function to find things in a table orrange by row. For example, look up theprice of an automotive part by the part number, or find an employee name based on their employee ID. With XLOOKUP, you can look in one column for a search term and return a result from the same row in another column, regardless of which side the return column is on.

Note:XLOOKUP is not available in Excel 2016 and Excel 2019, however, you may come across a situation of using a workbook in Excel 2016 or Excel 2019 with the XLOOKUP function in it created by someone else using a newer version of Excel.

XLOOKUP function - Microsoft Support (1)

Syntax

TheXLOOKUPfunction searches a range or an array, and then returns the itemcorrespondingto thefirst match it finds. If no match exists,then XLOOKUP can return theclosest (approximate) match.

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

Argument

Description

lookup_value

Required*

The value to search for

*If omitted, XLOOKUP returns blank cells it finds in lookup_array.

lookup_array

Required

The array or range to search

return_array

Required

The array or range to return

[if_not_found]

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.

[match_mode]

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.

2 - A wildcard match where *, ?, and ~ have special meaning.

[search_mode]

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.

Examples

Example 1uses XLOOKUP to look up a country name in a range, and then return its telephone country code. It includes the lookup_value (cell F2), lookup_array (range B2:B11), and return_array (range D2:D11) arguments. It doesn't include the match_mode argument, as XLOOKUP produces an exact match by default.

XLOOKUP function - Microsoft Support (2)

Note:XLOOKUP uses a lookup arrayand a return array, whereas VLOOKUP uses a single table array followed by a column index number. The equivalent VLOOKUP formula in this case would be: =VLOOKUP(F2,B2:D11,3,FALSE)

———————————————————————————

Example 2looks up employee information based on an employee ID number. Unlike VLOOKUP, XLOOKUP can return an array with multiple items, soa single formula can return both employee name and department from cells C5:D14.

XLOOKUP function - Microsoft Support (3)

———————————————————————————

Example 3adds anif_not_found argument to the preceding example.

XLOOKUP function - Microsoft Support (4)

———————————————————————————

Example 4looks in column C for the personal income entered in cell E2, and finds a matching tax rate in column B. It sets the if_not_found argument to return0 (zero) if nothing is found. The match_mode argument is set to 1, which means the function will look for an exact match, and if it can't find one, it returns the next larger item. Finally, the search_mode argument is set to 1, which means the function will search from the first item to the last.

XLOOKUP function - Microsoft Support (5)

Note:XARRAY's lookup_array column is to the right of the return_array column, whereas VLOOKUP can only look from left-to-right.

———————————————————————————

Example 5uses a nested XLOOKUP function to perform both a vertical and horizontal match. It first looks for Gross Profit in column B, then looks for Qtr1 in the top row of the table (range C5:F5), and finally returns the value at the intersection of the two. This is similar to using the INDEX and MATCH functions together.

Tip:You can also use XLOOKUP to replace the HLOOKUP function.

XLOOKUP function - Microsoft Support (6)

Note:The formula in cells D3:F3 is: =XLOOKUP(D2,$B6:$B17,XLOOKUP($C3,$C5:$G5,$C6:$G17)).

———————————————————————————

Example 6uses the SUM function, and two nested XLOOKUP functions, to sum all the values between two ranges. In this case, we want to sum the values for grapes, bananas, and include pears, which are between the two.

XLOOKUP function - Microsoft Support (7)

The formula in cell E3 is:=SUM(XLOOKUP(B3,B6:B10,E6:E10):XLOOKUP(C3,B6:B10,E6:E10))

How does it work? XLOOKUP returns a range, so when it calculates, the formula ends up looking like this: =SUM($E$7:$E$9). You can see how this works on your own by selecting a cell with an XLOOKUP formula similar to this one, then selectFormulas > Formula Auditing > Evaluate Formula, and then select Evaluateto step through the calculation.

Note:Thanks to Microsoft Excel MVP, Bill Jelen, for suggesting this example.

———————————————————————————

See also

You can always ask an expert in the Excel Tech Communityor get support inCommunities.

XMATCH function

Excel functions (alphabetical)

Excel functions (by category)

XLOOKUP function - Microsoft Support (2024)

References

Top Articles
Four of Pentacles Tarot Card Meaning: Upright and Reversed - Tarot With Joy
Fluid mechanics - PDF Free Download
Funny Roblox Id Codes 2023
Golden Abyss - Chapter 5 - Lunar_Angel
Www.paystubportal.com/7-11 Login
Joi Databas
DPhil Research - List of thesis titles
Shs Games 1V1 Lol
Evil Dead Rise Showtimes Near Massena Movieplex
Steamy Afternoon With Handsome Fernando
Which aspects are important in sales |#1 Prospection
Detroit Lions 50 50
18443168434
Newgate Honda
Zürich Stadion Letzigrund detailed interactive seating plan with seat & row numbers | Sitzplan Saalplan with Sitzplatz & Reihen Nummerierung
Grace Caroline Deepfake
978-0137606801
Nwi Arrests Lake County
Justified Official Series Trailer
London Ups Store
Committees Of Correspondence | Encyclopedia.com
Pizza Hut In Dinuba
Jinx Chapter 24: Release Date, Spoilers & Where To Read - OtakuKart
How Much You Should Be Tipping For Beauty Services - American Beauty Institute
Free Online Games on CrazyGames | Play Now!
Sizewise Stat Login
VERHUURD: Barentszstraat 12 in 'S-Gravenhage 2518 XG: Woonhuis.
Jet Ski Rental Conneaut Lake Pa
Unforeseen Drama: The Tower of Terror’s Mysterious Closure at Walt Disney World
Ups Print Store Near Me
C&T Wok Menu - Morrisville, NC Restaurant
How Taraswrld Leaks Exposed the Dark Side of TikTok Fame
University Of Michigan Paging System
Dashboard Unt
Access a Shared Resource | Computing for Arts + Sciences
Speechwire Login
Healthy Kaiserpermanente Org Sign On
Restored Republic
3473372961
Craigslist Gigs Norfolk
Moxfield Deck Builder
Senior Houses For Sale Near Me
Whitehall Preparatory And Fitness Academy Calendar
Jail View Sumter
Nancy Pazelt Obituary
Birmingham City Schools Clever Login
Thotsbook Com
Funkin' on the Heights
Vci Classified Paducah
Www Pig11 Net
Ty Glass Sentenced
Latest Posts
Article information

Author: Rob Wisoky

Last Updated:

Views: 5958

Rating: 4.8 / 5 (68 voted)

Reviews: 83% of readers found this page helpful

Author information

Name: Rob Wisoky

Birthday: 1994-09-30

Address: 5789 Michel Vista, West Domenic, OR 80464-9452

Phone: +97313824072371

Job: Education Orchestrator

Hobby: Lockpicking, Crocheting, Baton twirling, Video gaming, Jogging, Whittling, Model building

Introduction: My name is Rob Wisoky, I am a smiling, helpful, encouraging, zealous, energetic, faithful, fantastic person who loves writing and wants to share my knowledge and understanding with you.