How to Lookup Function in Excel

Learn multiple Excel methods to perform lookups with step-by-step examples and practical applications.

excelformulaspreadsheettutorial
13 min read • Last updated: 7/2/2025

How to Lookup Function in Excel

Why This Task Matters in Excel

Every data analyst, financial professional, or operations manager eventually faces a common challenge: “I have data in one place and related information in another—how can I pull it together quickly?” Lookup techniques are Excel’s answer to that problem. Whether you are merging a price from a master table into a sales log, pulling an employee’s department from an HR sheet, or matching thousands of SKU codes to product descriptions, an accurate lookup can save hours of manual copy-and-paste and eliminate human error.

Imagine a retailer analyzing last quarter’s sales. The transactional table lists a million order lines containing only SKU codes and unit quantities. Without lookup skills, the analyst would need to type descriptions, categories, and unit costs line by line. With a single formula copied down the column, the analyst can enrich the entire dataset in seconds. The same logic applies in finance, where consolidating trial balance data from different legal entities depends on aligning account codes, or in logistics, where a dispatch schedule references warehouse IDs that must be mapped to addresses for routing.

These techniques also underpin dashboards and interactive models. Drop-down selectors and dynamic charts usually rely on lookup formulas behind the scenes: choose a customer name in a slicer, and an XLOOKUP (or INDEX-MATCH pair) instantly retrieves that customer’s latest order value. Consequently, lookup proficiency connects directly to other Excel skills such as data validation, pivot tables, Power Query, and VBA automation. Failing to master lookups often results in spreadsheets riddled with redundant data, inconsistent naming, and higher risks of broken links—which in a business setting translates into missed insights and costly mistakes. In short, efficient lookups turn raw, scattered information into coherent, decision-ready intelligence.

Best Excel Approach

For most modern Excel versions (Microsoft 365, Excel 2021, Excel for the web), the XLOOKUP function is the preferred tool. It overcomes the historical limitations of VLOOKUP and HLOOKUP, supports approximate and exact matches, looks both to the right and left, and provides built-in error handling. Only when you work in an environment locked to older versions should you default to VLOOKUP, HLOOKUP, or an INDEX-MATCH combination.

Key reasons XLOOKUP is best:

  1. One syntax covers vertical and horizontal lookups.
  2. It does not require the return column to be to the right of the lookup column.
  3. Explicit arguments make formulas self-documenting.
  4. Optional arguments handle missing values gracefully, reducing the need for IFERROR wrappers.
  5. It is faster than multiple nested MATCH or VLOOKUP calculations on very large ranges.

Syntax overview:

=XLOOKUP(lookup_value, lookup_array, return_array, [if_not_found], [match_mode], [search_mode])
  • lookup_value – the value you are trying to find.
  • lookup_array – the one-dimensional range where Excel searches for the value.
  • return_array – the one-dimensional range from which Excel returns a result once a match is located.
  • [if_not_found] – optional text or calculation to display if nothing matches.
  • [match_mode] – zero for exact, minus one for exact or next smaller, one for exact or next larger, two for wildcard.
  • [search_mode] – one for first-to-last, minus one for last-to-first.

Alternative syntax for older versions:

=INDEX(return_column, MATCH(lookup_value, lookup_column, 0))

This INDEX-MATCH combo still offers a flexible, two-way lookup when XLOOKUP is unavailable.

Parameters and Inputs

Before you write a single formula, make sure your data is clean and organized:

  • Lookup value: must exactly match the data type in the lookup array. For example, “123” (text) is different from 123 (number).
  • Lookup array: should be a single column or single row. Mixed data types may cause unexpected approximate matches.
  • Return array: must be parallel to the lookup array—row counts must match for vertical lookups, column counts for horizontal ones.
  • Optional [if_not_found]: can be text like \"Not Found\", a number, a formula, or blank (\"\"). Keep it concise to avoid cluttering downstream calculations.
  • Match mode: in most business contexts you want exact match (0). Use wildcard mode when partial inputs are common, for example searching product codes starting with \"AB\".
  • Search mode: default first-to-last is fastest. Last-to-first can be helpful for time-series datasets where you want the latest entry.

Edge case considerations:

  • Leading or trailing spaces in the lookup column break exact matches. Use TRIM or CLEAN on imported CSV data.
  • Duplicate keys: XLOOKUP returns the first match unless you deliberately switch to last-to-first search mode.
  • Unsorted data with approximate mode equals unpredictable results. Approximate matches require sorted lookup arrays.
  • Merged cells inside lookup arrays prevent reliable matching—unmerge or build a clean helper column first.

Step-by-Step Examples

Example 1: Basic Scenario – Fetch a Product Price

Scenario: A small wholesaler maintains a list of product codes and their unit prices in sheet “Master”. Sales reps type codes into an order form and need the correct price to appear automatically.

Sample data:

Master [Sheet]Order Form [Sheet]
ABAB
SKUUnit PriceSKUUnit Price
P1008.50P105(formula)
P10112.00P101(formula)
P1024.75P999(formula)

Steps:

  1. Click cell B2 on the Order Form.
  2. Enter the formula:
=XLOOKUP(A2, Master!A:A, Master!B:B, "Price missing")
  1. Press Enter and copy down.

Explanation:

  • A2 is the SKU typed by the sales rep.
  • Master!A:A is the lookup array containing all valid SKUs.
  • Master!B:B is the return array containing corresponding prices.
  • If the SKU is not found, \"Price missing\" alerts the user to check the code.

Why it works: XLOOKUP scans the SKU column until it encounters the first exact match. Because both arrays are entire columns, the formula remains correct even if new items are appended below. Copying the formula down expands pricing to as many order lines as necessary.

Variations:

  • Add data validation to restrict SKUs in column A to valid entries, reducing “Price missing” errors.
  • Use a named range [SKU_List] for lookup_array to make the formula easier to read: =XLOOKUP(A2, SKU_List, Price_List).
  • If your sheet is shared with colleagues on Excel 2016, fall back to INDEX-MATCH:
=INDEX(Master!B:B, MATCH(A2, Master!A:A, 0))

Troubleshooting tips:

  • If every formula shows “#N/A”, check for stray spaces in either column.
  • If prices are retrieved but appear as text, apply Currency format to the return column.

Example 2: Real-World Application – Multi-Criteria Employee Lookup

Scenario: An HR team stores staff data across two sheets. Sheet “Directory” lists Employee ID, Name, and Department. A dashboard on sheet “Headcount” allows the user to pick a department and choose an employee from a drop-down. The dashboard then displays the employee’s manager, hire date, and location. Because employees can transfer departments, we need to verify both Employee ID and current Department to ensure we return a unique record.

Data snapshot:

Directory
ABCDEF
EmpIDNameDepartmentManagerHire DateLocation
1007A. WongSalesH. Lang2018-04-12Dallas
1007A. WongMarketingJ. Shin2021-09-01Chicago
1012B. PatelFinanceM. Fox2016-06-17Seattle

Complication: Employee 1007 appears twice; lookup must consider both ID and Department.

Solution: Build a helper column concatenating both criteria in column G of Directory:

=A2 & "|" & C2

Now we can create a unique “key” like \"1007|Marketing\".

On the dashboard:

  1. Cell B2 contains the chosen Department (validated list).
  2. Cell B3 contains the chosen Employee ID (validated list filtered by department).
  3. In cell B5 (Manager), use:
=XLOOKUP(B3 & "|" & B2, Directory!G:G, Directory!D:D, "Not found")
  1. Similarly retrieve Hire Date and Location by changing the return_array.

Why this solves a business problem: HR leadership often requests headcount reports filtered by division. Multi-criteria lookups allow dynamic, interactive dashboards without manual pivot table refreshes or error-prone filters.

Performance considerations: Even on a 20 000-row Directory sheet, concatenation plus XLOOKUP is instantaneous. For 200 000 rows and up, convert Directory to an Excel Table, turn off full column references, and limit ranges to the table columns to reduce calculation workload.

Example 3: Advanced Technique – Two-Way Lookup in a Large Financial Model

Scenario: A multinational conglomerate forecasts sales by product group across 12 regions and five scenarios (Base, Stretch, Downside, Worst, Best). The main model uses a control panel where the analyst picks Region in cell B1 and Scenario in cell B2. The result cells below must pull the corresponding values from an enormous grid in sheet “ForecastData”.

The grid has Region codes down the rows [A2:A5000] and Scenario names across the columns [B1:F1]. Using XLOOKUP plus XMATCH we can perform the two-way match without INDEX:

=XLOOKUP($B$1, ForecastData!$A$2:$A$5000,
  XLOOKUP($B$2, ForecastData!$B$1:$F$1, ForecastData!$B$2:$F$5000)
)

Explanation:

  1. Inner XLOOKUP locates the correct scenario column.
  2. It returns a slice of the data range consisting of values for that column only (dynamic array behaviour).
  3. Outer XLOOKUP then searches that one-column slice for the region and outputs the single, correct forecast figure.

Edge cases and error handling:

  • Regions occasionally renamed? Add [if_not_found] to each XLOOKUP to propagate a clear message.
  • Scenario names sometimes misspelled? Use wildcard match mode 2:
=XLOOKUP($B$2 & "*", header_row, data_range, "Scenario?", 2)

Professional tips:

  • Name the header row as Scenario_Header and the full data block as Forecast_Block to improve readability.
  • Avoid volatile INDIRECT functions, which recalculate every time the sheet changes. XLOOKUP remains non-volatile but still dynamic.
  • If performance degrades with millions of rows, move the raw data to Power Query or Power Pivot and use structured measures instead of cell formulas.

Tips and Best Practices

  1. Convert data to Excel Tables – Structured references like Table1[SKU] make formulas resilient to row insertions and easier to read.
  2. Use named ranges for lookup arrays – A well-named range [Customer_IDs] is self-documenting and reduces accidental expansion beyond the data boundary.
  3. Wrap with IFERROR sparingly – XLOOKUP already supports [if_not_found]. Extra IFERROR layers hide legitimate issues and can slow down the workbook.
  4. Keep lookup arrays narrow – Full column references are convenient but expensive in older files. Restrict the range to the exact data extent whenever performance is critical.
  5. Document assumptions – Include a comment or a separate documentation sheet explaining that the SKU list must contain unique entries. This aids future maintenance.
  6. Validate keys – Use Conditional Formatting to highlight duplicate keys in the lookup column; duplicates can compromise accuracy.

Common Mistakes to Avoid

  1. Mismatched data types – A number stored as text fails an exact lookup. Recognize this when numbers align left instead of right in the cell. Fix by multiplying the column by 1 or using VALUE.
  2. Hard-coding column numbers in VLOOKUP – People change the column order and all formulas break. Switch to XLOOKUP, or use MATCH inside INDEX.
  3. Assuming uniqueness – Duplicate keys cause lookup functions to return the first instance, possibly outdated. Detect duplicates with COUNTIF and resolve them before relying on lookups.
  4. Using approximate match on unsorted data – In VLOOKUP, approximate mode leads to random results if the lookup column is not ascending. Always specify FALSE (exact) or sort the data first.
  5. Overusing volatile INDIRECT – INDIRECT allows dynamic ranges but recalculates constantly, slowing workbooks. Structured references or XLOOKUP’s ability to accept whole arrays is faster and safer.

Alternative Methods

Sometimes one lookup approach outperforms others depending on Excel version, dataset shape, or user preference.

MethodExcel VersionProsCons
XLOOKUP365/2021Two-way lookup, both directions, built-in errors, dynamic arraysNot in Excel 2019 or earlier
INDEX-MATCHAllWorks in any version, flexible, handles left lookupsSlightly longer to write, two functions to troubleshoot
VLOOKUPAllFamiliar to many users, single functionCannot look left, breaks if columns shift, slower
HLOOKUPAllHorizontal equivalent when data is laid out in rowsSame limitations as VLOOKUP, less common layout
FILTER365/2021Returns multiple rows at once, easy to stack criteriaCan spill thousands of rows unintentionally, not in older Excel
Power Query Merge2010 and laterHandles millions of rows, point-and-click interface, refreshableRequires data model refresh, not real-time in grid
VBA Dictionary lookupAny with macros enabledLightning quick on very large datasets, full controlRequires coding skill, security prompts, maintenance overhead

Choose XLOOKUP for day-to-day analysis, fall back to INDEX-MATCH in mixed-version environments, and escalate to Power Query when scale eclipses the worksheet grid.

FAQ

When should I use this approach?

Use lookup formulas whenever you need to enrich or validate data by matching keys between two tables—pricing sheets, customer directories, or budget templates are classic examples. If the data volume is under a few hundred thousand rows and you need instant feedback in the grid, lookup formulas are ideal.

Can this work across multiple sheets?

Yes. Simply qualify the lookup_array and return_array with the sheet name, for example Sheet2!A:A. For workbooks with many tabs, consider naming the ranges to reduce cross-sheet formula length.

What are the limitations?

Lookups depend on the integrity of the key column. If keys are missing, duplicated, or inconsistent, results will be wrong. Additionally, traditional worksheet lookups slow down once you exceed roughly one million formula cells; beyond that, Power Query, Power Pivot, or a database is recommended.

How do I handle errors?

Leverage the [if_not_found] parameter in XLOOKUP to supply a friendly message or a blank. For INDEX-MATCH, wrap with IFERROR. Log rows that return errors into a separate sheet for investigation so you can fix upstream data instead of masking the symptom.

Does this work in older Excel versions?

INDEX-MATCH and VLOOKUP are fully supported back to Excel 97. XLOOKUP requires Microsoft 365, Excel 2021, or Excel for the web. FILTER and other dynamic array functions also require modern versions.

What about performance with large datasets?

Use Tables instead of full columns, disable automatic calculation while pasting large blocks, and avoid volatile functions such as INDIRECT. XLOOKUP is multi-threaded and often faster than a similar VLOOKUP, but for multi-million-row datasets, switch to Power Query or load the data into the Excel Data Model.

Conclusion

Mastering lookup techniques turns Excel from a simple calculator into a relational data engine. With XLOOKUP, INDEX-MATCH, or even Power Query merges, you can stitch together fragmented datasets, drive interactive dashboards, and eliminate manual errors. These skills cascade into other areas—pivot tables become more meaningful, charts more accurate, and VBA automation more robust. Continue practicing on real business scenarios, refine your data hygiene, and explore advanced features like dynamic arrays to take your Excel proficiency to the next level.

We use tracking cookies to understand how you use the product and help us improve it. Please accept cookies to help us improve.