Table of Contents
SYNTAX
To utilize the XLOOKUP function effectively, understanding its syntax and parameters is essential. The syntax for XLOOKUP in Excel is as follows:
=XLOOKUP(lookup_value,lookup_array,return_array,[if_not_found],[match_mode],[search_mode])
- Lookup_value: The item you are searching for.
- Lookup_array: The cell range where the search will be conducted.
- Return_array: The cell range from which the result will be retrieved.
- [if_not_found]: The value returned if no match is found. If omitted, unmatched searches will return #N/A.
-
[match_mode]: Specifies the type of match (exact or approximate). This is optional, with a default setting of 0 (exact match).
- 0 – Exact match. If no match is found, it returns #N/A.
- -1 – Exact match or the next smaller item.
- 1 – Exact match or the next larger item.
- 2 – A wildcard match where *, ?, and ~ have special meanings.
-
[search_mode]: Determines the search direction (left to right or right to left). This is optional, with a default of 1 (left to right).
- 1 – Search starts from the first item.
- -1 – Reverse search starting from the last item.
- 2 – Binary search requiring the lookup_array to be sorted in ascending order. If unsorted, it may yield incorrect results.
- -2 – Binary search requiring the lookup_array to be sorted in descending order. If unsorted, it may yield incorrect results.
Now that you're acquainted with the XLOOKUP syntax, let's delve into using XLOOKUP with multiple criteria.
- Method 1 – Boolean
- Method 2 – Concatenate
Be sure to download this Excel Workbook to follow along and learn how to use XLOOKUP with multiple criteria:
download excel workbookXLOOKUP-with-multiple-criteria.xlsx
METHOD 1 – BOOLEAN
XLOOKUP stands out due to its capability to handle multiple criteria simultaneously. The most effective approach to achieve this is by employing XLOOKUP with multiple criteria using Boolean logic. Despite the term sounding complex, it essentially deals with a simple condition – either true or false.
In this example, we aim to find the price of a product that meets three conditions:
- Product Category is Pants
- Size is L
- Color is Blue
Let's break down the formula step by step!
STEP 1: Input the first argument – Lookup_value. Here, our lookup value is 1. This is because test arrays will only return 1 when all criteria are satisfied.
=XLOOKUP(1,
STEP 2: Input the second argument – Lookup_array. Here, we're applying XLOOKUP with multiple criteria, which we'll refer to as our test arrays.
- First, the product category must be Pants. We search for "Pants" in the entire array A2:A13.
- Second, the size should be L. We search for "L" in the entire array B2:B13.
- Finally, the color should be Blue. We search for "Blue" in the entire array C2:C13.
=XLOOKUP(1,(A2:A13=G1)*(B2:B13=G2)*(C2:C13=G3),
STEP 3: Input the third argument – Return_array. Here, we select the entire array containing all the prices, i.e., D2:D13.
=XLOOKUP(1,(A2:A13=G1)*(B2:B13=G2)*(C2:C13=G3),D2:D13)
We are constructing a set of conditions to meet in our search. We aim for an exact match by using the “=” operator.
=XLOOKUP(1,(A2:A13=G1)*(B2:B13=G2)*(C2:C13=G3),D2:D13)
The test arrays will yield TRUE or FALSE as outcomes, where TRUE signifies that the condition is met and FALSE indicates that it is not.
=XLOOKUP(1,{FALSE;FALSE;FALSE;FALSE;TRUE;TRUE;TRUE;TRUE;FALSE;FALSE;FALSE;FALSE}*{TRUE;FALSE;TRUE;FALSE;TRUE;FALSE;TRUE;FALSE;TRUE;FALSE;TRUE;FALSE}*{FALSE;FALSE;TRUE;TRUE;FALSE;FALSE;TRUE;TRUE;FALSE;FALSE;TRUE;TRUE},D2:D13)
The multiplication operator converts TRUE and FALSE to 1s and 0s.
=XLOOKUP(1,{0;0;0;0;0;0;1;0;0;0;0;0},D2:D13)
We can also view this in a more straightforward manner.
Cell G1 contains the product category to be searched in the array A2:A13. The function will search for “Pants” in each row of the selected array. It will return the value 1 for every row where a match is found, and 0 for no matches.
Similarly, you input arguments to search for the required Size (in cell G2) and Color (in cell G3) in the corresponding columns B2:B13 and C2:C13.
Finally, we multiply each argument using the “*” operator. This ensures that only the row returning a value of 1 meets all the specified criteria.
In the result, you can see that only Row 7 has TRUE matches in all three columns (Lookup arrays), hence it returns the value 1. When multiplying, only Row 7 will return the value 1, as all others will have at least one 0 in their formula, resulting in 0 as well.
METHOD 2 – CONCATENATION
When using Boolean logic, you test different criteria and use TRUE or FALSE results to extract the desired value. Alternatively, you can combine or join your lookup values and the lookup arrays to search for multiple criteria simultaneously.
You can use the Ampersand (&) sign for concatenation. The & sign acts as a concatenation operator and joins texts from different cells.
Click here to discover three different ways to concatenate in Excel!
Let's use the same example to see how to use the & sign and make XLOOKUP work with multiple criteria.
STEP 1: Input the first argument – Lookup_value. Here, our lookup value is the concatenation of the three conditions in cells G1, G2, and G3.
=XLOOKUP(G1&G2&G3,
We have combined all the criteria we want to look up. Our three criteria are in cells G1, G2, and G3, namely Product type, size, and color. Using the “&” operator, we have joined the cells to look up these values simultaneously.
STEP 2: Input the second argument – Lookup_array.
=XLOOKUP(G1&G2&G3,A2:A13&B2:B13&C2:C13,
We have similarly combined the corresponding lookup arrays for Product Category, Size, and Color using the “&” operator. Ensure the sequence of lookup values matches the corresponding lookup arrays.
STEP 3: Input the third argument – Return_array. Finally, we select the Price column D2:D13 as we want to extract the price of the product.
=XLOOKUP(G1&G2&G3,A2:A13&B2:B13&C2:C13,D2:D13)
Using the & sign, you can easily apply XLOOKUP with multiple criteria and achieve the desired result.
Conclusion
You can use either Boolean logic or the & sign to apply XLOOKUP with multiple criteria in Excel. The concatenation method might be simpler, but Boolean logic offers greater flexibility and power. Choose the method that best fits your needs and application.
Please Note – XLOOKUP is exclusively available for Microsoft 365 users. Ensure you upgrade your account to utilize XLOOKUP with multiple criteria.
Click here to explore how to use XLOOKUP in Excel through 11 different examples and applications.
The above is the detailed content of 2 Best Ways on How to Use XLOOKUP with Multiple Criteria. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undress AI Tool
Undress images for free

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Grouping by month in Excel Pivot Table requires you to make sure that the date is formatted correctly, then insert the Pivot Table and add the date field, and finally right-click the group to select "Month" aggregation. If you encounter problems, check whether it is a standard date format and the data range are reasonable, and adjust the number format to correctly display the month.

Quick Links Check the File's AutoSave Status

The tutorial shows how to toggle light and dark mode in different Outlook applications, and how to keep a white reading pane in black theme. If you frequently work with your email late at night, Outlook dark mode can reduce eye strain and

To set up the repeating headers per page when Excel prints, use the "Top Title Row" feature. Specific steps: 1. Open the Excel file and click the "Page Layout" tab; 2. Click the "Print Title" button; 3. Select "Top Title Line" in the pop-up window and select the line to be repeated (such as line 1); 4. Click "OK" to complete the settings. Notes include: only visible effects when printing preview or actual printing, avoid selecting too many title lines to affect the display of the text, different worksheets need to be set separately, ExcelOnline does not support this function, requires local version, Mac version operation is similar, but the interface is slightly different.

It's common to want to take a screenshot on a PC. If you're not using a third-party tool, you can do it manually. The most obvious way is to Hit the Prt Sc button/or Print Scrn button (print screen key), which will grab the entire PC screen. You do

MicrosoftTeamsrecordingsarestoredinthecloud,typicallyinOneDriveorSharePoint.1.Recordingsusuallysavetotheinitiator’sOneDriveina“Recordings”folderunder“Content.”2.Forlargermeetingsorwebinars,filesmaygototheorganizer’sOneDriveoraSharePointsitelinkedtoaT

Finding the second largest value in Excel can be implemented by LARGE function. The formula is =LARGE(range,2), where range is the data area; if the maximum value appears repeatedly and all maximum values ??need to be excluded and the second maximum value is found, you can use the array formula =MAX(IF(rangeMAX(range),range)), and the old version of Excel needs to be executed by Ctrl Shift Enter; for users who are not familiar with formulas, you can also manually search by sorting the data in descending order and viewing the second cell, but this method will change the order of the original data. It is recommended to copy the data first and then operate.

TopulldatafromthewebintoExcelwithoutcoding,usePowerQueryforstructuredHTMLtablesbyenteringtheURLunderData>GetData>FromWebandselectingthedesiredtable;thismethodworksbestforstaticcontent.IfthesiteoffersXMLorJSONfeeds,importthemviaPowerQuerybyenter
