How to Use Excel's HLOOKUP Function

Quickly search and retrieve data by row

In This Article

Jump to a Section

When the data in your Excel worksheet covers hundreds of columns and dozens of rows, use the HLOOKUP function to find a specified value in a specified column.

Instructions in this article apply to Excel for Microsoft 365, Excel 2019, Excel 2016, and Excel 2013.

How the HLOOKUP Function Works

The HLOOKUP function is a type of search function. This function searches for specific information in a worksheet by first finding the specified value in the column labels and searching that column for the corresponding value.

The HLOOKUP function is best suited for worksheets with large amounts of data. This example uses a simple worksheet to show how the HLOOKUP function works.

Example worksheet with data that's set up for the HLOOKUP function in Excel

In this worksheet, a retailer tracks sales by product and by the channel where each product is sold. Instead of searching the worksheet to find the online sales for cameras, for example, the HLOOKUP function can perform the task.

Syntax of the HLOOKUP Function

The syntax of the HLOOKUP function is:

HLOOKUP(lookup_value,table_array,row_index_num,range_lookup)

Here's what each argument does in the HLOOKUP function:

  • lookup_value (required): The column to be searched. The HLOOKUP function searches the first row to find this value. This argument can be a cell reference or a column label.
  • table_array (required): The table to be searched for the specified data. This can be a reference to a range or a range name.
  • row_index_num (required): The number of the row from which Excel will return data.
  • range_lookup (optional): This argument tells the HLOOKUP function what to do if it doesn't find an exact match. Argument values are TRUE and FALSE.
    • If the value is TRUE and the table data is sorted from smallest to largest, HLOOKUP returns the largest value that is smaller than the lookup_value argument.
    • If the value if FALSE, the HLOOKUP function returns an error if an exact match isn't found.

How to Use HLOOKUP in Excel

This example uses the HLOOKUP function to find the online sales for cameras. Here's how to enter the formula in a worksheet:

  1. Enter the worksheet data, then organize the column names in ascending order.

  2. Select the cell that will display the result of the HLOOKUP function.

    Setting up an Excel worksheet to use the HLOOKUP function
  3. Select Formulas > Lookup & Reference > HLOOKUP.

    The Formulas tab in Excel with the Lookup & Reference functions displayed
  4. In the Function Arguments dialog box, place the cursor in the Lookup_value text box.

  5. In the worksheet, select the cell that contains the value you want to find in the top row of data.

    The Function Arguments dialog box in Excel for the HLOOKUP function

    Use a cell reference if you want to search for different values. To search for a different value, enter a different name in the cell.

  6. In the Function Arguments dialog box, place the cursor in the Table_array text box.

  7. In the worksheet, select the data you want to search. In this example, the entire dataset is selected.

    The Function Arguments dialog box in Excel showing the arguments for HLOOKUP
  8. In the Function Arguments dialog box, place the cursor in the Row_index_num text box and enter the number of the row that contains the result you want.

    This is not the row number that appears in the Excel worksheet. This number is the row in the selected array.

  9. Select OK.

    The HLOOKUP function in Excel
  10. The HLOOKUP function searches the first row to find the lookup_value, and then it searches that column to find the specified value. The value appears in the selected cell.

    The results of the HLOOKUP function in an Excel worksheet

How to Use Wildcards With HLOOKUP

When you don't know the exact text or column name you need, use a wildcard with HLOOKUP. These are the wildcards you can use in Excel to perform a text search:

  • Asterisk (*): Use to indicate that at least one letter is missing from the search term. For example, when searching for a product and you're not sure if the name is Camera, Cameras, or Camera & Video, enter Camera*.
  • Question mark (?): Use to indicate that only one letter is missing from the search term. For example, when searching for a customer and you're not sure if the name is Petersen or Peterson, enter Peters?n.

Add as much information as you can to the wildcard search. Excel only returns one match and doesn't indicate if there are multiple matches.

Was this page helpful?