Smart Systems for Home

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

HLOOKUP in Excel: How to Use It Step by Step

· 6 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

HLOOKUP in Excel searches for a value in the top row of a table and returns a value from the same column in a row you specify. It is the horizontal counterpart to VLOOKUP: where VLOOKUP looks down the first column, HLOOKUP looks across the first row. To use it, you need a table where the lookup values sit in the first row and the return values are in a row below, then you write a formula like =HLOOKUP(lookup_value, table_array, row_index_num, [range_lookup]). This guide walks through the syntax, a working example, common errors and fixes.

What You'll Need

  • A spreadsheet in Excel (desktop, web or mobile) with data arranged so the lookup values are in the first row of the range.
  • Basic familiarity with cell references and formulas.
  • The exact lookup value you want to find (text, number or a cell reference).

Step-by-Step

  1. Lay out your data correctly. HLOOKUP only works horizontally. Put the values you will search for (for example, month names or product codes) in one row, and put the data you want to return in rows directly beneath that row. The lookup row must be the first row of the range you select. If your data is arranged vertically, use VLOOKUP or XLOOKUP instead.
  2. Select the cell for the result. Click the cell where the returned value should appear.
  3. Start the formula. Type =HLOOKUP(. Excel will show a tooltip with the argument names.
  4. Enter the lookup value. Type the value in quotes (for example "Mar") or click the cell that contains it. Using a cell reference is more flexible because you can change the value without editing the formula.
  5. Enter the table array. Select the range that includes the lookup row and all rows you might return from. For example, A1:E5. The first row of this range must contain the lookup values. You can use absolute references (like $A$1:$E$5) if you plan to copy the formula.
  6. Enter the row index number. This is the row number within the table array that contains the value you want. If your table array starts at row 1 and the return values are in row 3 of the sheet, and the range starts at row 1, the row index is 3. Count from the top of the selected range, not from the top of the sheet. For example, if the range is A1:E5 and you want row 3 of the sheet, the index is 3; if the range started at A2, row 3 of the sheet would be index 2.
  7. Choose the range lookup argument. Type FALSE (or 0) for an exact match, which is what you usually want for text or IDs. Type TRUE (or 1) for an approximate match, which requires the first row to be sorted in ascending order. If you omit this argument, Excel defaults to TRUE, which often gives wrong results.
  8. Close the parenthesis and press Enter. The formula should look like =HLOOKUP("Mar", A1:E5, 3, FALSE). The cell will show the value from the third row of the column where "Mar" appears in the first row.
  9. Copy the formula if needed. Drag the fill handle to apply it to other cells. If you used relative references, Excel adjusts them; use absolute references for the table array to keep it fixed.
  10. Test with a value you know exists. Change the lookup value to another entry in the first row and confirm the result updates correctly. If it returns an error, see Troubleshooting below.

Common Mistakes

  • Using a vertical table. HLOOKUP expects the lookup row to be the first row of the range. If your labels are in a column, use VLOOKUP or XLOOKUP.
  • Forgetting the range_lookup argument. Omitting it makes Excel assume TRUE (approximate match), which can return the wrong value, especially with unsorted data. Always type FALSE for exact matches.
  • Miscounting the row index. The row index is relative to the table array, not the worksheet. If your range starts at row 2, the first row of the range is row 2, so a return value in worksheet row 4 is index 3.
  • Selecting a table array that does not include the lookup row. The first row of the range must contain the values you are searching for. If you select only the return rows, HLOOKUP will not find the lookup value.
  • Mismatched data types. A lookup value stored as text (like "123") will not match a number (123). Check that both are the same type, or use VALUE() to convert.
  • Extra spaces. Trailing spaces in cells can cause #N/A. Use TRIM() on the lookup value or clean the source data.

Tips

  • Use XLOOKUP if your version of Excel supports it; it handles horizontal and vertical lookups and defaults to exact match.
  • Name your table range (Formulas > Define Name) to make formulas easier to read and maintain.
  • Wrap HLOOKUP in IFERROR to show a friendly message instead of #N/A: =IFERROR(HLOOKUP(...), "Not found").
  • If you need to return multiple rows, copy the formula down and adjust the row index, or use INDEX and MATCH for more flexibility.
  • Keep the lookup row sorted if you use approximate match (TRUE), and always use FALSE for exact matches on text.

Troubleshooting

If HLOOKUP returns #N/A, the lookup value was not found in the first row of the table array. Check for typos, extra spaces, or mismatched data types. If it returns #REF!, the row index is larger than the number of rows in the table array. If it returns #VALUE!, the row index is not a number or the table array is invalid. If the result is wrong, confirm the range_lookup argument is FALSE for exact match and that the row index counts from the top of the selected range. If the formula worked before but now returns errors after copying, check that absolute references were used for the table array. For persistent issues, try retyping the formula or using the Formula Builder (Formulas > Insert Function) to see argument descriptions.

Frequently Asked Questions

What is the difference between HLOOKUP and VLOOKUP?

HLOOKUP searches horizontally across the first row of a range, while VLOOKUP searches vertically down the first column. Use HLOOKUP when your data is laid out with headers in a row; use VLOOKUP when headers are in a column.

Can HLOOKUP return a value from a row above the lookup row?

No. HLOOKUP only returns values from rows below the first row of the table array. To return a value from above, restructure your data or use INDEX and MATCH.

Why does HLOOKUP return the wrong value?

The most common cause is leaving out the range_lookup argument or setting it to TRUE when you need an exact match. Also check that the row index is correct and that the lookup row is the first row of the selected range.

Is HLOOKUP case-sensitive?

No, HLOOKUP is not case-sensitive. "Apple" and "apple" are treated the same. For case-sensitive lookups, use INDEX, MATCH and EXACT.

Can I use wildcards with HLOOKUP?

Yes, when range_lookup is FALSE, you can use ? and * in the lookup value for partial matches. For example, "Mar*" matches "March" and "Mary".

Does HLOOKUP work in Excel for the web and mobile?

Yes, HLOOKUP is available in Excel for the web and mobile apps, with the same syntax. Menu labels may differ slightly by version.