XLOOKUP Function in Excel

In our previous blog post we have already learned about 2 most useful lookup functions: VLOOKUP and HLOOKUP. In this blog post, we’ll explore what XLOOKUP is, its syntax, why you should use it, its pros and cons, and provide some practical examples. The XLOOKUP function revolutionize the way we search and retrieve data.

XLOOKUP function is a modern and versatile replacement for traditional lookup functions in Excel. It allows you to find things in a table or range by row, regardless of whether the return column is on the left or right side. It’s like a search engine for your Excel data. Here’s what you need to know:
  • Syntax:

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

    • lookup_value: The value you want to search for.
    • lookup_array: The range or array to search.
    • return_array: The range or array from which to return results.
    • [if_not_found]: (Optional) Specify what to return if no match is found.
    • [match_mode]: (Optional) Specify the match type (exact, approximate, wildcard).
    • [search_mode]: (Optional) Specify the search direction.

            Why you should use XLOOKUP?

            • XLOOKUP can search both horizontally and vertically, unlike VLOOKUP and HLOOKUP.
            • It can return an array with multiple items, making it more versatile.
            • XLOOKUP supports wildcard characters (* and ?) for partial matches.

            Pros and Cons of XLOOKUP

            ProsCons
            Flexible and powerfulNot available in Excel 2016 and 2019
            Handles both horizontal and vertical dataRequires familiarity with new syntax
            Supports wildcards for text dataMay not be widely used yet
            Can return multiple results

            Conditions Before Using XLOOKUP

            1. Excel Version- XLOOKUP is not available in Excel 2016 and 2019. Ensure you are using Excel 365 or Excel 2019 (with the latest updates) to access this function.

            2. Syntax Familiarity- XLOOKUP introduces a new syntax. Familiarize yourself with the function’s arguments and usage.

            3. Data Structure- XLOOKUP works best with structured data in tables or arrays. Ensure your data is organized with clear headers and consistent formats.

            Examples

            (Data File)

            Example #1: Nested XLOOKUP

            For this example we have a table of sales data with product names and corresponding prices in different regions. You want to find the price for a specific product in a given region. Here’s how you can nest XLOOKUP functions:

            =XLOOKUP(H4,B3:E3,XLOOKUP(H3,A3:A13,B3:E13))

            Example #2: Exact and Partial Match

            XLOOKUP can perform both exact and approximate matches.
            Use the [match_mode] argument to specify the match type (0 for exact, 1 for approximate).

            2.1 Exact Match

            Here we have a list of employee IDs and their corresponding names. To find an employee’s name based on their ID, we will use:
            =XLOOKUP(E4,A4:A13,B4:B13,"Employee Not Found",0 )
            

            2.2 Partial Match

            Here we have a list of sales target and their incentives rate. To find the incentive for a sale that partially matches the search term, we will use:
            =XLOOKUP(L4,H4:H13,I4:I13,"No Incentives",-1 )

            Example #3: Wildcards for Text Data

            XLOOKUP supports wildcard characters (* and ?) for partial matches. Useful when dealing with text-based lookup values.

            Suppose you have a list of employee name and their location. You want to find the location of an employee but you don't remember his full name then, use:
            =XLOOKUP("*Sharma",A4:A13,B4:B13,"Not Found",2)

            Example #4: 

            Customizing Not Found Results

            Specify a custom text in double quotes (e.g., “Not Found”) for cases where no match is found.
            Use the [if_not_found] argument. You can also use a formula if required

            For this we  have an example with Sales target amount and incentives rate when they achieve those sales target

            A) Customizing Not Found Results as a Formula:

            You want to deduct Rs. 200 from the basic criteria incentive rate, i.e. Rs. 100. So, if the sales are below Rs. 50000, the final output should be Rs. 800.
            Otherwise, it should show the rates given. 
            The formula is:
            =XLOOKUP(E5,A4:A13,B4:B13,B4-200,-1)

            B) Customizing Not Found Results as a Text Example:
            If the sales are below Rs. 50000, you want the output to be “No Incentives.”
            Otherwise, it should show the rates given.
            The formula is:
            =XLOOKUP(F5,A4:A13,B4:B13,"No Incentives",-1 )



            Example #5: Multiple Criteria Lookup

            XLOOKUP excels at handling multiple criteria. Use Boolean logic to apply conditions. 

            For this example we have a data for item details and we want to find price of an item with a specific size and color 

            =XLOOKUP(1, (A1:A11 = G1) * (B1:B11 = G2) * (C1:C11 = G3), D1:D11)
            This formula looks up a price based on Item, Size, and Color simultaneously.

            Example #6: Total Sales

            You can use formulas and operators to add, subtract, multiply, or divide values to obtain the total output as required.

            Suppose we have a sales data of employees in different region, and we want to find sales of an employee in all regions for this we have to add sales of all the regions (i.e. East, West, North and South).

            We can use this formula: =XLOOKUP(H3,A4:A13,B4:B13+C4:C13+D4:D13+E4:E13)

            Conclusion

            XLOOKUP is a game-changer in Excel. Embrace its flexibility, explore its capabilities. Whether you’re an Excel pro or a beginner, XLOOKUP is your new best friend! 

            Thank you for reading and happy learning.

            Comments

            Popular posts from this blog

            Introduction to Pivot Table in Excel - Advanced

            Introduction to Pivot Table in Excel - Basics