Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

How to Use XLOOKUP in Cell B3: A Step-by-Step Guide

· 7 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

To enter an XLOOKUP formula in cell B3, click on cell B3, type "=XLOOKUP(", select the lookup value, select the lookup array, select the return array, and press Enter. XLOOKUP is a modern, versatile replacement for the older VLOOKUP and HLOOKUP functions, designed to find specific values in a range or array and return a corresponding item from a different range. It is more intuitive because it does not require you to count column index numbers, and it can look both to the left and to the right of your search column.

What You'll Need

  • A spreadsheet application that supports XLOOKUP, such as Microsoft 365, Excel for the Web, or Excel 2021 and later versions.
  • A source dataset (a table or range of cells) that contains the information you want to retrieve.
  • A unique identifier in your dataset, such as an Employee ID, Product SKU, or Email Address, which will serve as the anchor for your search.
  • A target cell, which in this guide is cell B3, where the result will be displayed.
  • Knowledge of which column contains your search term (the lookup array) and which column contains the data you want to extract (the return array).

Step-by-Step

  1. Prepare your data environment: Ensure your source data is organized and free of obvious errors. For XLOOKUP to work effectively, the lookup array (where you search) and the return array (the data you want) must have the same number of rows or columns. If your lookup array spans from row 2 to row 100, your return array must also span from row 2 to row 100.
  2. Select cell B3: Click directly on cell B3. You will see a green border around the cell, indicating it is ready for input. If you have existing data in B3, typing the formula will overwrite it, so ensure you have backed up any important information.
  3. Start the formula: Type =XLOOKUP( into cell B3. Once you type the opening parenthesis, Excel will display a small tooltip below the cell. This tooltip is a visual guide that shows the syntax: lookup_value, lookup_array, return_array, [if_not_found], [match_mode], [search_mode].
  4. Define the Lookup Value: This is the criteria you are searching for. If you want to find information based on a value already typed in cell A3, click on cell A3 or type A3. If you want to search for a specific text string, type it in quotation marks, such as .
  5. Define the Lookup Array: After typing a comma, select the range of cells that contains the unique identifiers. For example, if your product IDs are listed in column E from row 2 to row 50, highlight that range or type E2:E50. This is the "search zone."
  6. Define the Return Array: After typing another comma, select the range of cells that contains the data you actually want to see in cell B3. For instance, if the prices for those products are in column F, highlight F2:F50. Note that this range must be the same size as your lookup array.
  7. Handle missing values (Optional but recommended): After the third comma, you can add an argument for [if_not_found]. If the value you are looking for doesn't exist, instead of seeing the ugly #N/A error, you can type . This makes your spreadsheet look professional and easier to read.
  8. Finalize the entry: Review your formula in the formula bar. It should look something like this: =XLOOKUP(A3, E2:E50, F2:F50, "Not Found"). Press the Enter key on your keyboard to execute the formula.

Common Mistakes

One of the most frequent errors is a mismatch in array dimensions. If your lookup array is E2:E50 (49 rows) and your return array is F2:F51 (50 rows), XLOOKUP will return a #VALUE! error because it cannot align the rows correctly. Always ensure the start and end row numbers are identical for both ranges.

Another common mistake is failing to use absolute references when planning to copy the formula. If you intend to drag the formula from B3 down to B4, B5, and so on, you must lock your arrays using the dollar sign (e.g., $E$2:$E$50). Without these dollar signs, Excel will shift the search range down as you move the formula, eventually looking at empty cells and returning errors.

Users also often confuse the 'lookup value' with the 'lookup array.' The lookup value is the single thing you know (like a single ID), while the lookup array is the entire list of possibilities. If you try to select a whole column as your lookup value, the formula will likely fail or return unexpected results.

Tips

To make your XLOOKUP even more powerful, utilize the optional 'match_mode' argument. While XLOOKUP defaults to an exact match (which is safer than VLOOKUP's default), you can specify a match mode if you are working with numeric ranges. For example, if you are calculating tax brackets or discount tiers, you can use the match mode to find the next smaller or next larger item.

For better spreadsheet management, consider using Excel Tables (Ctrl + T). If you convert your source data into a Table, your XLOOKUP formula can use structured references like =XLOOKUP(A3, Table1[ID], Table1[Price]). The advantage here is that as you add new rows to your table, the XLOOKUP range expands automatically, meaning you never have to update your formula manually.

If you are looking for the very last occurrence of an item rather than the first, use the 'search_mode' argument. By setting the last argument to -1, XLOOKUP will search from the bottom of the list to the top. This is incredibly useful for finding the most recent transaction in a list of historical data.

Troubleshooting

If your formula returns #N/A, it means the value you are looking for truly does not exist in the lookup array. Check for hidden spaces. A common culprit is a cell that looks like but is actually (with a trailing space). You can use the TRIM() function to clean your data if this is the case.

If you see #NAME?, you are likely using an older version of Excel that does not support XLOOKUP. This function is only available in newer releases. Check your version by going to File > Account. If you are on an older version, you will need to use INDEX/MATCH or VLOOKUP as alternatives.

If you see #VALUE!, re-examine your array sizes. As mentioned in the mistakes section, the lookup array and the return array must be of equal length. Even a single row difference will trigger this error. Double-check the row numbers in your formula bar to ensure they match perfectly.

If the formula returns the wrong data, check your data types. If your lookup value is a number (e.g., 101) but the values in your lookup array are stored as text (indicated by a small green triangle in the corner of the cell), XLOOKUP will not see them as a match. You can fix this by selecting the column and changing the format to 'Number' or using the 'Text to Columns' feature to convert the data type.

Frequently Asked Questions

Can XLOOKUP look to the left?

Yes. Unlike VLOOKUP, which requires the lookup column to be the leftmost column in a range, XLOOKUP can search any column and return data from any other column, regardless of its position.

Do I need to sort my data for XLOOKUP?

No. By default, XLOOKUP performs an exact match and does not require the data to be sorted in ascending or descending order, which makes it much more robust than older lookup methods.

What is the difference between XLOOKUP and VLOOKUP?

XLOOKUP is more flexible, handles errors more gracefully with the 'if_not_found' argument, can search in any direction, and does not require a column index number, making it less prone to errors when columns are inserted or deleted.

How do I use XLOOKUP with multiple criteria?

While XLOOKUP is primarily designed for one criteria, you can perform a multi-criteria search by using the ampersand (&) to join criteria in the lookup value and the lookup array (e.g., =XLOOKUP(A3&B3, E2:E50&F2:F50, G2:G50)).

Is XLOOKUP available on Excel for Mac?

Yes, XLOOKUP is available on Microsoft 365 for Mac and Excel 2021 for Mac, provided your software is up to date.