Lookup functions are essential tools for anyone working with spreadsheets. Whether you’re managing inventory, analyzing sales data, or building financial models, understanding VLOOKUP, HLOOKUP, and XLOOKUP will dramatically improve your productivity. This comprehensive guide covers everything you need to know about these powerful functions in both Microsoft Excel and Google Sheets.
What Are VLOOKUP, HLOOKUP, and XLOOKUP?
VLOOKUP, HLOOKUP, and XLOOKUP are lookup functions that search for specific values in your spreadsheet and return related information from your data tables.
VLOOKUP (Vertical Lookup) searches for a value in the first column of a table and returns a value in the same row from a specified column. It’s the most widely used lookup function and works vertically down your data.
HLOOKUP (Horizontal Lookup) works similarly to VLOOKUP but searches horizontally across the first row of a table and returns a value from a specified row below.
XLOOKUP is the newest and most powerful lookup function, available in Excel 365 and Excel 2021. It can search both vertically and horizontally, offers more flexibility, and solves many limitations of VLOOKUP and HLOOKUP.
How Do You Use VLOOKUP in Excel and Google Sheets?
The VLOOKUP syntax is: =VLOOKUP(lookup_value, table_array, col_index_num, [range_lookup])
In Excel:
=VLOOKUP(A2, D2:F10, 3, FALSE)In Google Sheets:
=VLOOKUP(A2, D2:F10, 3, false)Here’s what each argument means:
- lookup_value: The value you want to find (e.g., a product ID or employee name)
- table_array: The range of cells containing your data table
- col_index_num: The column number in your table that contains the return value (1 is the first column)
- range_lookup: FALSE or 0 for exact match, TRUE or 1 for approximate match
Practical Example: If you have a product list with IDs in column D, names in column E, and prices in column F, you can use =VLOOKUP("P-101", D2:F10, 3, FALSE) to find the price of product P-101.
When Should You Use HLOOKUP Instead of VLOOKUP?
Use HLOOKUP when your data is organized horizontally with headers in rows rather than columns. This is common in financial reports, quarterly summaries, and dashboard layouts where data runs across the page.
The HLOOKUP syntax is: =HLOOKUP(lookup_value, table_array, row_index_num, [range_lookup])
Example in Excel:
=HLOOKUP("Q1", B1:E5, 3, FALSE)This formula searches for “Q1” in the first row and returns a value from the third row down. HLOOKUP is less common than VLOOKUP because most databases and tables are organized vertically, but it’s invaluable when working with horizontally structured data.
Real-world use case: Monthly expense reports where months run across the top row and expense categories run down the first column benefit from HLOOKUP to pull specific values.
What Makes XLOOKUP Better Than VLOOKUP and HLOOKUP?
XLOOKUP revolutionizes lookup functions with several major improvements:
1. Bidirectional Search: XLOOKUP can search both vertically and horizontally without changing the function.
2. No Column Index Needed: Instead of counting columns, you simply reference the return range directly.
3. Left-Side Lookups: Unlike VLOOKUP, XLOOKUP can return values from columns to the left of your lookup column.
4. Built-in Error Handling: You can specify what to display if no match is found without using IFERROR.
5. Reverse Search: XLOOKUP can search from bottom to top or right to left.
The XLOOKUP syntax is: =XLOOKUP(lookup_value, lookup_array, return_array, [if_not_found], [match_mode], [search_mode])
Excel XLOOKUP Example:
=XLOOKUP(A2, D2:D10, F2:F10, "Not Found", 0, 1)Important Note: XLOOKUP is currently only available in Excel 365, Excel 2021, and Excel for the web. It is not yet available in Google Sheets as of January 2025.
How Do VLOOKUP and HLOOKUP Differ in Google Sheets vs Excel?
Both VLOOKUP and HLOOKUP work similarly in Google Sheets and Excel, but there are a few key differences:
Syntax Differences:
- Google Sheets accepts lowercase TRUE/FALSE or 1/0 for the range_lookup argument
- Excel traditionally uses uppercase TRUE/FALSE but accepts lowercase as well
Performance:
- Google Sheets processes formulas in the cloud, which can be slower with very large datasets
- Excel processes locally, often providing faster results with complex lookups
Array Formulas:
- Google Sheets has more robust array formula support with ARRAYFORMULA
- You can wrap VLOOKUP in ARRAYFORMULA to apply it to entire columns automatically
Example Google Sheets Array Formula:
=ARRAYFORMULA(VLOOKUP(A2:A100, D2:F200, 3, false))This applies the VLOOKUP to all cells from A2 to A100 in one formula.
What Are Common Errors with VLOOKUP, HLOOKUP, and XLOOKUP?
#N/A Error: The lookup value wasn’t found in your table. This happens when:
- The value doesn’t exist in the first column (VLOOKUP) or row (HLOOKUP)
- There are extra spaces or formatting differences
- You’re using exact match but the value is slightly different
#REF! Error: The column or row index number is larger than the table size. Double-check your col_index_num or row_index_num.
#VALUE! Error: Usually caused by incorrect data types or invalid arguments.
#NAME? Error: The function name is misspelled, or XLOOKUP isn’t available in your Excel version.
Tips to Avoid Errors:
- Use TRIM function to remove extra spaces:
=VLOOKUP(TRIM(A2), D2:F10, 3, FALSE) - Wrap formulas in IFERROR:
=IFERROR(VLOOKUP(A2, D2:F10, 3, FALSE), "Not Found") - Ensure your lookup column is formatted consistently (text vs numbers)
Which Lookup Function Should You Choose?
Choose VLOOKUP when:
- Your data is organized vertically in columns
- You need a reliable function that works across all Excel and Google Sheets versions
- Your lookup column is to the left of your return column
Choose HLOOKUP when:
- Your data is organized horizontally in rows
- You’re working with cross-tabulated data or pivot-style layouts
Choose XLOOKUP when:
- You have Excel 365 or Excel 2021
- You need to look left (return values from columns before the lookup column)
- You want simpler syntax and better error handling
- You need to search in reverse order or handle multiple match scenarios
How Can You Combine VLOOKUP, HLOOKUP, and XLOOKUP with Other Functions?
Combining lookup functions with other Excel and Google Sheets functions creates powerful data solutions:
INDEX-MATCH Alternative: While XLOOKUP replaces many INDEX-MATCH scenarios, you can still use:
=INDEX(F2:F10, MATCH(A2, D2:D10, 0))Multiple Criteria Lookup:
=VLOOKUP(A2&B2, D2:G10, 4, FALSE)(Requires helper column combining criteria)
Nested Lookups:
=VLOOKUP(VLOOKUP(A2, D2:E10, 2, FALSE), H2:J20, 3, FALSE)With IFERROR for Cleaner Results:
=IFERROR(XLOOKUP(A2, D2:D10, F2:F10), "No match found")With IF Statements:
=IF(A2="", "", VLOOKUP(A2, D2:F10, 3, FALSE))What Are Best Practices for Using VLOOKUP, HLOOKUP, and XLOOKUP?
- Always use absolute references for your table array:
$D$2:$F$10instead ofD2:F10when copying formulas down - Use exact match (FALSE or 0) unless you specifically need approximate matching for sorted data
- Name your ranges for easier maintenance:
=VLOOKUP(A2, ProductTable, 3, FALSE) - Keep your lookup tables organized with no blank rows or columns
- Document your formulas with comments or nearby explanations for complex lookups
- Consider data validation on lookup values to prevent typos
- Test with sample data before applying to large datasets
- Use structured references in Excel tables for dynamic ranges
- Optimize for performance by avoiding volatile functions in lookup formulas
- Plan for errors by building in IFERROR or using XLOOKUP’s built-in error handling
Conclusion
Mastering VLOOKUP, HLOOKUP, and XLOOKUP transforms how you work with data in Excel and Google Sheets. VLOOKUP remains the workhorse for vertical data lookups, HLOOKUP handles horizontal scenarios, and XLOOKUP offers modern flexibility for Excel 365 users. By understanding when to use each function and following best practices, you’ll build more efficient, error-free spreadsheets that save time and improve accuracy.
Whether you’re a beginner learning your first lookup function or an advanced user optimizing complex models, these three functions form the foundation of effective data analysis and reporting in spreadsheets.





