The Wayback Machine - https://web.archive.org/web/20241128003729/https://www.geeksforgeeks.org/xlookup-function-in-excel-with-examples/
Open In App

XLOOKUP Excel With Examples: Complete Guide

Last Updated: 30 Oct, 2024

A

Summarize
Comments
Improve
Suggest changes
Like Article
Like
Save
Share
Report
News Follow

The XLOOKUP function in Excel is a powerful and flexible tool designed to replace older lookup functions like VLOOKUP and HLOOKUP. Unlike these traditional functions, XLOOKUP can search both vertically and horizontally, making it ideal for retrieving specific values from any range in a table. With added benefits like default exact matching and the ability to handle errors more gracefully, XLOOKUP makes data retrieval in Excel easier and more reliable.

In this article, we will cover how XLOOKUP works, its syntax, and practical examples to help you make the most of this versatile function.

XLOOKUP-Function-in-Excel-With-Examples

XLOOKUP Function in Excel With Examples

What is XLOOKUP in Excel

XLOOKUP is a powerful function in Excel designed to search for a specific value in a range and return a corresponding value from another range. It replaces older functions like VLOOKUP and HLOOKUP, addressing their limitations by allowing for more flexible searches, including reverse lookups and partial matches.

XLOOKUP Formula in Excel with Example

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

XLOOKUP Formula Explanation

=XLOOKUP(search for this value, in this range, and Return a match from this range).

Arguments Explained

  • lookup_value: The value you want to search for.
  • lookup_array: The range of cells where Excel will search for the lookup value.
  • return_array: The range of cells from which to return the result.
  • if_not_found (optional): Value to return if no match is found.
  • match_mode (optional): Specifies the type of match (exact, approximate, or wildcard).
  • search_mode (optional): Determines the search direction (first-to-last or last-to-first).
Match Type Behavior
0 (default) Here it will look for an exact match
-1 If we do not get the exact match then it will return the next smaller item.
1 If we do not get the exact match then it will return the next larger item.
2 It will do partial matching using (* or ~)
  • search_mode (Optional): where we can specify how the function should look up the value.
Search mode Behavior
1(default) It will search the values first.
-1 It will search the values in reverse from last. 
2 It will perform a binary search and data needs to be sorted in ascending order.
-2 It will perform a binary search and data needs to be sorted in descending order.

How to Enable XLOOKUP in Excel

To access the XLOOKUP function in Excel, you need to be using a version of Excel that supports it.

How to Enable XLOOKUP in Excel 365

XLOOKUP is included in Excel 365, which is a subscription-based version of Excel that receives regular updates and new features.

How to Enable XLOOKUP in Excel 2019

XLOOKUP was introduced in Excel 2019, which is a one-time purchase version of Excel. However, it might not be available in older versions of Excel, such as Excel 2016 or earlier.

Step-by-Step Guide to Using XLOOKUP in Excel

Step 1: Open Excel

Start by opening your Excel application and loading the worksheet containing your data.

Step 2: Select a Cell

Click on an empty cell where you want to display the result of your XLOOKUP function.

Step 3: Start Typing the Formula:

  • Type =XLOOKUP( into the selected cell. Excel will prompt you with a list of arguments.

Step 4: Enter Required Arguments:

  • lookup_value: Specify the value you are searching for (e.g., a cell reference like A2).
  • lookup_array: Select the range where Excel should look for this value (e.g., B2:B10).
  • return_array: Choose the range from which you want to retrieve data corresponding to the found value (e.g., C2:C10).

Example formula:

=XLOOKUP(A2, B2:B10, C2:C10)

Optional Arguments:

  • If desired, add optional arguments such as if_not_found to handle cases where no match is found.
  • Use match_mode to specify how closely you want Excel to match your lookup value (0 for exact match, 1 for next largest, etc.).
  • Set search_mode if you want to control whether it searches from first to last or vice versa.

Step 5: Complete the Formula

Close the parentheses and press Enter. Your formula should now return the corresponding value based on your criteria.

XLOOKUP Example in Excel: 6 Examples Explained

Below are some examples through which the XLOOKUP function will be easily understandable.

Example 1: Using XLOOKUP for Exact Matches

This function in XLOOKUP is by default. Follow the below steps to Lookup a value:

Step 1: Format your data

XLOOKUP Function in Excel

Enter you Data

Now, if we want to get the math marks of Carry then follow the next step

Step 2: Enter the Formula

We will enter =XLOOKUP(E2, A2:A5, B2:B5) in the F2 cell to get the marks of carrying.

XLOOKUP Function in Excel

Enter the Formula

Then we will get the math marks for carry.

Example 2: How to Approximate Match in Excel

If you want to find the closest (approximate) match to a specified value, use match mode -1 (next smaller) or 1 (next larger):

Step 1: Format your data

Step 2: Enter Formula

Let’s consider the below example for Approximate match mode.

XLOOKUP Function in Excel

Format your Data

Formula used is : =XLOOKUP(lookup value, in this range, Return a value from this range, -1)

Here -1 will return the approximate value which is smaller than the lookup value. 

Note: The user can also use 1 instead of -1 to return a value larger than the lookup value. The XLOOKUP function can also work for Unsorted data.

Example 3: How to Use Left Lookup in Excel

Unlike VLOOKUP, XLOOKUP can perform a left lookup, allowing you to search for values on the left side of the data:

Step 1: Format your data

Step 2: Use Formula

Using INDEX and MATCH in Excel left lookup can be performed but to make it simple and quick you can also use the XLOOKUP function. This XLOOKUP function is used to search the values which are on the left side of the searched values.

The formula used: = XLOOKUP(Search for this value, from this range, and return the output from this range)

Here the output we are looking for will be from the left side of the column.

Example 4: How to Use XLOOKUP on Multiple Values

You can combine XLOOKUP with additional functions for more complex lookups. To retrieve a value based on multiple conditions, use concatenation or an array formula:

Step 1: Format your data

XLOOKUP Function in Excel

Enter and Format your Data

Now, if we want to get the Math and English marks for carrying then follow the next step

Step 2: Enter the Formula

We will enter =XLOOKUP(E2,A2:A5,B2:C5) in F2 cell.

XLOOKUP Function in Excel

Enter the Formula

Step 3: Marks Obtained

Then we will get the Math and English marks.

XLOOKUP Function in Excel

Marks Obtained

Example 5: How to Use Nested XLOOKUP function in Excel

Follow the below steps to use nested XLOOKUP functions:

Step 1: Format your data

XLOOKUP Function in Excel -(1)

Format your Data

Now, if we want to get the math marks of Carry by two-way lookup then follow the next step.

Step 2:Enter the Formula

We will enter =XLOOKUP(F1,B1:C1,XLOOKUP(E2,A2:A5,B2:C5)) in F2 cell.

Here, XLOOKUP(E2, A2:A5, B2:C5) is{100,80} which is an array mark of Carry. In the outer XLOOKUP formula, we are looking for the subject name which is in the F1 cell and the lookup array is B1:C1.

XLOOKUP Function in Excel

Enter the Formula

Step 3: Marks Displayed

Then we will get the math marks of carry.

XLOOKUP Function in Excel

Marks Displayed

Example 6: How to Use Not Found in Excel

Follow the below steps when the LOOKUP function returns the Not Found message:

Step 1: Format your data

XLOOKUP Function in Excel

Format your Data

If we want the marks of Sunny who is not in the dataset

Step 2: Enter Formula

We will enter =XLOOKUP(E2,A2:A5,B2:B5,”Not Found”) in F2 cell.

XLOOKUP Function in Excel

Enter your Data

Step 3: Not Found Displayed

Then it will show Not Found.

XLOOKUP Function in Excel

Not Found Displayed

Example 4: How to Use SUM function in Excel

Follow the below steps to find the sum of a range:

Step 1: Format your data.

XLOOKUP Function in Excel

Format your Data

If we want the total math marks from Harry to Jonny then do the next step

Step 2: Enter Formula

We will enter =SUM(XLOOKUP(E2,A2:A5,B1:B6):XLOOKUP(F2,A2:A5,B1:B6)) in G2 cell this simply means =SUM($B$2:$B$5).

XLOOKUP Function in Excel

Enter your Formula

Step 3: Sum Displayed

Then we will get the sum.

XLOOKUP Function in Excel

Sum Displayed

Example 5: How to Use Horizontal Lookup in Excel

Step 1: Format your data

XLOOKUP Function in Excel

Format your Data

Now, if we want to get the math marks of Carry then follow the next step

Step 2: Enter the Formula

We will enter =XLOOKUP(B6,B1:E1,B2:E2) in B7 cell.

XLOOKUP Function in Excel

Format your Data

Step 3: Carry Marks Displayed

Then we will get the math marks of Carry

XLOOKUP Function in Excel

Carry Marks Obtained

Example 6: How to Use Last Match in Excel

Follow the below steps to use last match in Excel:

Step 1: Enter your data

Step 2: Enter the XLOOKUP Formula

By default, the XLOOKUP Function performs a top-to-bottom search. But if the user wants to change this order and search for the bottom to top then the formula should be: =XLOOKUP(Search for the value, in this range, return the output from this range, -1)

Note: -1 in this formula should be the 6th parameter) 

XLOOKUP Vs VLOOKUP: Key Differences

XLOOKUP and VLOOKUP are Excel functions used for finding information in a table, but they have differences:

Feature XLOOKUP VLOOKUP
Lookup Type More versatile, handles both vertical and horizontal lookups. Primarily for vertical lookups.
Syntax Easier syntax, with no need to specify column numbers. Requires specifying column index, which can be cumbersome.
Error Handling Built-in error handling with custom error messages. Basic error handling using the “IFERROR” function.
Search Flexibility Supports wildcards for flexible searches. Defaults to exact matches; requires extra steps for approximate matches.
Return Values Can return arrays of values. Returns a single value, not suitable for multiple matches.
Dataset Compatibility Works well with large datasets and dynamic arrays. Limited to simpler tasks and smaller datasets.
Overall More user-friendly and powerful, especially for complex tasks. Simpler but has limitations.

Note: XLOOKUP is more versatile and user-friendly, especially for complex datasets and lookups across multiple columns or rows.

Advanced XLOOKUP Techniques

  • Nested XLOOKUP: Use XLOOKUP within another XLOOKUP for two-way lookups.
  • Horizontal Lookups: Perform searches across rows instead of columns.
  • Using XLOOKUP for Summation: Calculate totals over a specified range using XLOOKUP with SUM.

Conclusion

In conclusion, XLOOKUP is a revolutionary addition to Excel that addresses the limitations of VLOOKUP and HLOOKUP. By mastering XLOOKUP, you can perform efficient data searches, streamline your workflow, and enhance your overall productivity. Whether you’re a financial analyst, data scientist, or small business owner, leveraging XLOOKUP in your daily tasks will save you valuable time and effort.

XLOOKUP Function in Excel – FAQs

What is xlookup in Excel with an example?

XLOOKUP is a function in Excel that searches a range or array and returns an item corresponding to the first match it finds. It can search both vertically and horizontally.

Example:

To find the price of a product:

“=XLOOKUP(“ProductA”, A2:A10, B2:B10)”

In this example, “ProductA” is the value to look up in the range A2, and the function returns the corresponding value from the range B2

How do I use xlookup in Excel?

To accomplish this, type =XLOOKUP( into the formula bar. Next, enter your lookup criteria—this is the value you want to search for. XLOOKUP can handle both numbers and text strings, but typically, users will enter a cell reference (like A2) for convenience.

What is xlookup multiple criteria?

XLOOKUP in Excel allows you to search values on multiple conditions and is achieved by concatenating the criteria within the lookup value and lookup array.

How to use xlookup in Excel with two worksheets?

Follow the steps given below:

  • Identify the Lookup Value
  • Identify the Lookup and Return Arrays
  • Write the XLOOKUP Formula in Sheet1
  • Explanation of the Formula

How to use xlookup to find matching data?

Here are the steps to create the XLOOKUP function in Excel:

  1. Type =XLOOKUP( into a cell.
  2. For the lookup_value, enter the salesperson’s name in double quotes (e.g., “Jackie”).

Tip: If the name is already in a cell (such as G4), you can simply reference that cell instead of typing the name.

How to use xlookup for multiple columns?

Follow the steps given below:

  • Identify the Lookup Value
  • Identify the Lookup and Return Arrays
  • Enter the XLOOKUP Formula in Sheet1
  • View the Result

How to copy the XLOOKUP formula in Multiple Cells?

While copying an XLOOKUP formula to multiple cells, Lock the LOOKUP or return ranges with Absolut cell reference to prevent them from changing.



A

News
Improve
Discuss

XLOOKUP vs INDEX-MATCH in Excel

article_img
XLOOKUP can figure out the following more modest or the following bigger worth when there is no definite match. INDEX-MATCH can likewise do such, yet the lookup_array should be arranged in climbing or dropping requests. Both help match Wildcards. XLOOKUP can figure out either the first or the last worth when different qualities match. XLOOKUP versus INDEX and MATCH We have seen that INDEX/MATCH is a lot quicker than XLOOKUP. In this informational index, we're taking a gander at a bunch of SKUs from an online business store, alongside the number of deals for each. In segment G we've made an equation that looks for the SKU in section B and takes out the comparing number of deals. Separating the MATCH work The INDEX work takes two required contentions - the exhibit and the column number in the cluster. By contributing our deals cluster (D3:D10) and folding the INDEX work over the match work, the absolute Sales of 12 are returned in light of the fact that '12' is in the principal line of the exhibit. Subsequent to doing this a couple of times, getting the hang of INDEX+MATCH for this kind of situation is extremely simple. How about we perceive how XLOOKUP handles a similar issueâ€Ķ XLOOK
Read More

How to Create Calculated Columns in Power Pivot in Excel: A Complete Guide

article_img
Power Pivot in Excel is a powerful data modelling tool that enables advanced calculations on large datasets. One of its standout features is calculated columns, which allow users to derive new data by applying custom formulas to existing columns. In this article, we’ll cover what calculated columns are, how to create them in Power Pivot, and their advantages and limitations. Table of ContentWhat are Calculated Columns in ExcelCreate Calculated Columns in Power Pivot in ExcelHow to Create Calculated Columns in Power Pivot in Excel ExamplesAdvantages of Calculated Columns in Power PivotLimitations of Calculated Columns in Power PivotUnderstanding Calculated Columns in Excel Power PivotCalculated columns are dynamic columns in Power Pivot that allow users to create new data by applying formulas or expressions to existing data. Unlike calculated fields, which are computed on-the-fly based on the context, calculated columns compute their values during data refresh. This makes them suitable for pre-computed data scenarios, such as sorting, filtering, complex calculations, or creating hierarchies. How to Create Calculated Columns in Power Pivot in ExcelFollow these steps to create calcula
Read More

How to Create a Waterfall Chart in Excel: A Complete Guide

article_img
A waterfall chart in Excel is a powerful visual tool that helps you understand the cumulative effect of sequential values, whether they’re positive or negative. It's perfect for tracking financial data, such as revenue changes, profit margins, or expense breakdowns, making it easier to see how each component contributes to the total. In this article, you’ll learn how to create a waterfall chart step by step, transforming raw data into an insightful visual representation. Get ready to unlock a new level of data analysis and storytelling with Excel's waterfall charts! Table of Content What is a Waterfall ChartUses of Waterfall Chart How to Create a Waterfall Chart in Excel - Easy Steps How to Customize the Waterfall Chart How to Build an Excel Bridge Chart Drawbacks of Using Excel for Waterfall ChartsFeatures of the Waterfall Chart in ExcelWhat is a Waterfall Chart in Microsoft ExcelA Waterfall Chart in Excel, also known as a Waterfall Graph, Waterfall Plot, or Excel Bridge Chart, is a specialized column chart designed to help visualize incremental changes in data. Often referred to as a chunk chart or Excel Waterfall Diagram, it is crucial for understanding the cumulative effect of
Read More

P

How to Lock Cells In Excel: A Complete Guide

article_img
How to Protect Cells in Excel Spreadsheet- Quick StepsSelect the cells you want to protect.Right-click, choose Format Cells>>Go to the Protection tab>> check Locked.Go to the Review tab>> click Protect Sheet >> set a password (optional) >>click OK.Locking cells in Excel or Protecting Cells in Spreadsheet is essential for protecting your data from unintended edits, especially in shared or collaborative workbooks. When you lock cells, you can prevent changes to specific parts of a worksheet, ensuring that formulas, values, and structure remain intact. Here’s a complete guide on how to lock cells in Excel and protect your data effectively. Lock Cell in Excel Spreadsheet (Keyboard Shortcut)The keyboard shortcut to lock or unlock a cell in Excel is Alt H O L. This is a toggle shortcut, so it switches between locking and unlocking. You can also lock cells in Excel by using the Format Cells dialogue box: Select the cells you want to lockOn the Home tab, in the Alignment group, select the small arrow to open the Format Cells popup windowOn the Protection tab, select the Locked check boxSelect OK to close the popup You can also lock a formula in Excel by pressi
Read More

How to Enable Macros in Excel: A Complete Guide for Windows, Mac, and Office 365

article_img
How to Activate Macro in Excel- Quick StepsOpen MS Excel>>Go to FileSelect Options >>Trust Centre >>Trust Centre SettingsEnable Macros>> Click ok If you're working with advanced Excel features or custom scripts, you may need to know how to turn on macros in Excel. Macros are essential for automating repetitive tasks and running custom scripts, but they are disabled by default to protect against potential risks. Whether you’re using Windows or Mac, enabling macros is a straightforward process that requires just a few settings adjustments. This guide will walk you through step-by-step instructions on how to enable macros in Excel, unblock them if needed, and ensure your files run smoothly while maintaining security. Table of Content What Are Macros in Excel?Why Are Macros Disabled by Default?How to Enable Macros in ExcelHow to Enable a Single Macro in an Excel File How to Enable Macros in a Single Excel FileHow to Unblock Macros in Excel How to Disable Macros in ExcelCommon Macro-Related Issues and FixesExcel Macro Security: Understanding the Risks and PrecautionsWhat Are Macros in ExcelMacros in Excel are a sequence of actions that can be recorded and execute
Read More

How to Password Protect an Excel File on Windows and Mac: A Complete Guide

article_img
How to Lock a Excel Sheet with Password - Quick StepsOpen the Excel file Click on File >>Select Info.Protect Workbook >> Choose Encrypt with Password.Set Password >> confirm your password.Securing your sensitive data in Excel files is essential, and one of the most effective ways to do this is by using password protection. Whether you're safeguarding financial reports, confidential business data, or personal spreadsheets, learning how to password protect an Excel file is a crucial skill. This feature allows you to restrict access to your files, ensuring only authorized individuals can view or edit the content. In this guide, you’ll learn the step-by-step process to add password protection to your Excel files on both Windows and Mac. Additionally, we’ll cover how to unprotect files or sheets if you need to make changes, ensuring you have complete control over your data. Note: The password protection may not work for CSV files in some MS Excel versions. Table of Content Why Password Protect an Excel FileHow to Password Protect an Excel File on WindowsHow to Password Protect an Excel Sheet on MacHow to Lock Specific Cells in ExcelHow to Password Protect an Excel Shee
Read More

How to Calculate Standard Deviation in Excel: Quick Guide with Formulas and Examples

article_img
Understanding standard deviation in Excel is crucial for anyone looking to measure the spread or variability of a data set. Whether you're a student analyzing exam scores, a business professional evaluating sales data, or a researcher interpreting experimental results, knowing how to calculate standard deviation in Excel can provide valuable insights into your data. In this post, we'll go through the steps on how to calculate standard deviation in Excel, answer common questions like how do you find standard deviation in Excel, and provide a standard deviation Excel example. By the end, you'll be able to confidently determine standard deviation in Excel, making your data analysis more robust and accurate. Let's explore the powerful tool of standard deviation in Excel with the formulas and examples. Table of Content What is Standard DeviationFormula for Standard Deviation Why Use Standard Deviation Formula in ExcelDifference between Sample and Population Standard DeviationHow to Calculate Standard Deviation in ExcelSample Standard Deviation Functions in ExcelWhich Excel Standard Deviation Function to UseExcel Standard Deviation Formula ExamplesExample of How to Calculate Standard Dev
Read More

How to use Copilot in Excel with Examples (Step-by-Step Guide)

article_img
As of 2024, Microsoft introduced a new feature called Copilot for Excel, part of the broader Microsoft 365 suite, designed to enhance productivity and streamline data manipulation using AI-powered tools. The introduction of Excel Copilot is transforming how professionals across industries manage and interpret their data. This AI-driven tool enhances productivity, automates repetitive tasks, and simplifies complex data analysis. In this detailed guide, we'll explore how to effectively use Copilot in Excel, complete with practical examples to illustrate its capabilities. Table of Content What is Copilot in Excel?How to Access Copilot in ExcelExcel Copilot Advantages in ExcelHow to Use Copilot in Excel (November 2024)Different Ways to use Copilot in Excel (Including Copilot Prompt)What is Copilot in Excel?Microsoft Excel Copilot is an innovative, AI-powered feature designed to enhance productivity and streamline data processing tasks within Excel. As a part of the Microsoft 365 suite, Excel Copilot transforms how users interact with data by offering advanced artificial intelligence capabilities that simplify complex operations, automate repetitive tasks, and provide actionable insight
Read More

How to use VLOOKUP in Excel - Step by Step Guide with Examples

article_img
VLOOKUP is one of the most powerful and widely used functions in Excel, allowing you to search for specific data in a table and retrieve corresponding values efficiently. Imagine working with a large dataset, like a product inventory or employee list, and needing to quickly find information such as prices, IDs, or contact details. VLOOKUP simplifies this process by automating data lookup tasks, saving time and reducing errors. Whether you're a beginner or an experienced Excel user, mastering VLOOKUP can significantly enhance your productivity. This step-by-step guide, complete with real-world examples, will teach you how to use VLOOKUP in Excel effectively, making it an indispensable tool for managing and analyzing data. Dive in to learn how this function works and how you can apply it to your spreadsheets. Table of Content What is VLOOKUP in ExcelHow VLOOKUP WorksHow to Use VLOOKUP in Excel - Quick StepsHow do you use VLOOKUP in Excel - ExampleHow To Create a VLOOKUP Between Two SheetsHow to Do VLOOKUP in Excel with Two WorkbooksCommon Troubleshooting Tips for VLOOKUP Function in ExcelWhat is VLOOKUP in ExcelVLOOKUP, short for "Vertical Lookup," is a powerful function in Microsoft
Read More

Editing Excel Macros in Excel

article_img
Excel Macro is a set of actions that can be recorded, saved, used multiple times. This feature saves us a lot of time when dealing with repetitive tasks and huge data sets. We can always make changes to an existing Macro in Excel. There are two ways to record and run macros: Excel Commands Excel Visual Basic for Applications(VBA).1. Copying a Macro Code We can reuse the existing macro code while creating new Macros. For example, if you have existing macros created using the record function, we can reuse the code to write new macros. To open the code follow the below steps: Select Tools --> Macros --> Visual Basic Editor. Copy code from the existing macros(use Command + C) and paste(use Command + V) in the new macro2. Renaming a Macro Follow the below steps to rename a Macro in Excel: Select Tools --> Macros --> Visual Basic Editor. Select name on the left plane.Edit the name.3. Deleting a Macro Follow the below steps to delete a macro in Excel: Select Tools --> Macros --> Macros... Select the macro to be deleted. Click on the minus(-) symbol at the bottom.Select yes to delete the macro.
Read More
three90RightbarBannerImg