VLOOKUP and HLOOKUP Together: How to Combine Them

Formulas & functions · Updated November 23, 2026

Yes, you can use VLOOKUP and HLOOKUP together in a single formula, but the practical way to do it is to nest one inside the other (for example, VLOOKUP(HLOOKUP(...), ...)) or to use them sequentially in separate helper columns. The most common real-world need is a two-way lookup where you match a row label and a column label at the same time; for that, a single INDEX/MATCH pair is usually simpler, but combining VLOOKUP and HLOOKUP works when your data is laid out as a grid with headers on both axes.

What VLOOKUP and HLOOKUP Each Do

VLOOKUP (Vertical Lookup) searches for a value in the first column of a table and returns a value from a specified column to the right. HLOOKUP (Horizontal Lookup) searches for a value in the first row of a table and returns a value from a specified row below. Both use the same syntax pattern: VLOOKUP(lookup_value, table_array, col_index_num, [range_lookup]) and HLOOKUP(lookup_value, table_array, row_index_num, [range_lookup]).

The key difference is orientation. VLOOKUP works down a column; HLOOKUP works across a row. They are not interchangeable, but they can be nested because each returns a single value that can be used as the lookup value for the other.

Why You Might Need Both at Once

The classic scenario is a two-dimensional table: products in rows, months in columns, and sales figures in the intersecting cells. To find the sales for a specific product in a specific month, you need to match both the row label (product) and the column label (month). A single VLOOKUP can only match the row, and a single HLOOKUP can only match the column. Combining them lets you match both.

Another scenario is when your lookup table has a header row that itself contains dynamic values (for example, a date that changes based on another cell). You might use HLOOKUP to find which column contains that date, then feed that column number into a VLOOKUP.

How to Nest VLOOKUP Inside HLOOKUP (and Vice Versa)

Assume you have a table with product names in A2:A10, months in B1:M1, and sales data in B2:M10. You want the sales for “Widget” in “March”.

First, find the column number for March using HLOOKUP: HLOOKUP("March", B1:M1, 1, FALSE) returns the position of “March” within the range B1:M1 (so 3 if months start at January in B1). Then use that result as the column index in VLOOKUP:

With product in A2:A10 and data in B2:M10, the combined formula is:

=VLOOKUP("Widget", A2:M10, HLOOKUP("March", B1:M1, 1, FALSE), FALSE)

This returns the value at the intersection of the Widget row and the March column. The HLOOKUP part evaluates first, giving a number like 3, which VLOOKUP uses as its column index. Check the arithmetic: if B1 is January, C1 is February, D1 is March, then HLOOKUP returns 3, and VLOOKUP returns the value from column 3 of A2:M10 (which is column D in the sheet).

You can also nest VLOOKUP inside HLOOKUP if your data is oriented the other way, but that is less common because column numbers are usually easier to derive.

Using Helper Columns Instead of Nesting

Nesting works, but it can be hard to read and debug. A cleaner alternative is to use a helper column that combines the row and column keys. For example, add a column that concatenates the product and month: =A2&"|"&B1 (copied down and across), then use a single VLOOKUP with a concatenated lookup value: =VLOOKUP("Widget|March", A2:M10, 2, FALSE). This avoids nesting entirely and is often faster to audit.

Helper columns also let you use exact matches more reliably, because you control the key format. However, they add data to your sheet, so you may want to place them far to the right or on a separate sheet.

Common Problems and How to Fix Them

  • #N/A errors: The lookup value is not found. Check for extra spaces, different text case, or numbers stored as text. Use TRIM() and VALUE() to clean data.
  • Wrong column number: If your HLOOKUP range starts at B1, the returned number is relative to B1, not the sheet. Make sure the VLOOKUP table_array starts at the same column as the HLOOKUP range.
  • Approximate match problems: If you omit the last argument or use TRUE, Excel may return a wrong but close match. Always use FALSE for exact matches unless you deliberately need the nearest value.
  • Case sensitivity: VLOOKUP and HLOOKUP are not case-sensitive. If you need case-sensitive matching, use INDEX/MATCH with EXACT.
  • Performance: Nesting two lookups in a large dataset can slow things down. If you have thousands of rows, consider INDEX/MATCH or XLOOKUP instead.

INDEX/MATCH and XLOOKUP as Better Alternatives

For a two-way lookup, INDEX/MATCH is the classic alternative. The formula is:

=INDEX(B2:M10, MATCH("Widget", A2:A10, 0), MATCH("March", B1:M1, 0))

This returns the same result as the nested VLOOKUP/HLOOKUP but is more flexible: INDEX can return a value from any row and column, and MATCH can find positions in either direction. It also handles cases where your lookup columns are to the left of the return columns, which VLOOKUP cannot do.

If you have Excel 2021 or Microsoft 365, XLOOKUP is even simpler. You can use it twice, once for the row and once for the column:

=XLOOKUP("March", B1:M1, XLOOKUP("Widget", A2:A10, B2:M10))

The inner XLOOKUP returns the entire row for Widget, and the outer XLOOKUP picks the March column from that row. This is easier to read than nesting VLOOKUP and HLOOKUP.

Frequently Asked Questions

Can I use VLOOKUP and HLOOKUP in the same formula without nesting?

No, not in a single cell. They are separate functions, so you must nest one inside the other or use a helper column. The nesting order depends on which axis you want to resolve first. Usually you resolve the column with HLOOKUP and then the row with VLOOKUP, but you can reverse it if your data is transposed.

Does the order of arguments matter when nesting?

Yes. The inner function must return a value that the outer function can use. If you put VLOOKUP inside HLOOKUP, the VLOOKUP result must be a row number for HLOOKUP. In practice, you almost always want the inner function to return a column number for VLOOKUP, so put HLOOKUP inside VLOOKUP.

Why does my combined formula return the wrong value?

Most likely the HLOOKUP range and the VLOOKUP table_array do not start at the same column. For example, if your HLOOKUP range is C1:M1 but your VLOOKUP table starts at A2, the column number returned will be off by two. Always align the starting columns of both ranges.

Is there a limit to how many lookups I can nest?

Excel allows up to 64 levels of nesting for functions, so you could theoretically nest several VLOOKUPs and HLOOKUPs. But in practice, more than two or three becomes unreadable and error-prone. Use helper columns or switch to INDEX/MATCH for complex lookups.

Does this work in Google Sheets?

Yes, VLOOKUP and HLOOKUP exist in Google Sheets with the same syntax. However, Google Sheets also has XLOOKUP (as of 2022), so you can use the same XLOOKUP alternative there. The nesting rules and alignment issues are identical.

Final Recommendation

Combining VLOOKUP and HLOOKUP is a valid technique, but it is rarely the best one. For a two-way lookup, INDEX/MATCH or XLOOKUP is clearer, more flexible, and less prone to alignment errors. Use the nested VLOOKUP/HLOOKUP when you must stick to older functions or when you are working in a shared workbook that requires compatibility with older Excel versions. If you do use it, always test with a small sample and verify the column numbers match your table layout.

Related

Try it: the Formula Explainer: paste any formula and see each function and reference in plain English.

More in Formulas & functions

Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources

Spotted an error in this guide? Let us know.