Skip to content

Use LOOKUP to replace VLOOKUP and HLOOKUP in Excel

Why VLOOKUP and HLOOKUP cause errors in financial models, and when LOOKUP, INDEX and MATCH or XLOOKUP do the same job more safely.

Tutorial · 6 minute read · Updated 28 October 2026

LOOKUP tutorial workbook

Excel binary workbook (.xlsb). The lookup examples from this tutorial, with VLOOKUP and HLOOKUP replaced by LOOKUP and by INDEX and MATCH.

A lookup function takes a value, finds it in a data range and returns related information from that range, without scrolling through a list. VLOOKUP and HLOOKUP are the best known, but they have drawbacks that lead to errors, especially for people who did not build the model. This tutorial shows when LOOKUP replaces them, and when INDEX and MATCH or XLOOKUP is the better choice.

VLOOKUP and HLOOKUP

VLOOKUP searches a range laid out in columns. HLOOKUP does the same for a range laid out in rows.

VLOOKUP

VLOOKUP looks for a value in the leftmost column of a range and returns the value in the same row from a column you choose. Use it when the values to compare sit in a column to the left of the data you want.

VLOOKUP(lookup_value, table_array, col_index_num, range_lookup)

If range_lookup is TRUE or left out, VLOOKUP returns an approximate match: if there is no exact match, it returns the next largest value that is less than lookup_value. If range_lookup is FALSE, it looks for an exact match.

Figure 1 shows price data. The first column holds the price case, the next columns hold information about each case and the remaining columns hold the price for each calendar year.

Price data with the price case in the first column, information about each case in the next columns and a price for each calendar year, retrieved with VLOOKUP
Figure 1: Retrieving the price for the selected price case with VLOOKUP.

To return the price for the selected price case, the col_index_num is 4 for CY2023, 5 for CY2024 and so on. range_lookup is FALSE because the first column is not sorted.

HLOOKUP

HLOOKUP does the same as VLOOKUP for data laid out in rows. It looks for a value in the top row of a range and returns the value in the same column from a row you choose.

HLOOKUP(lookup_value, table_array, row_index_num, range_lookup)

Learn this in a room

Best Practice Project Finance Modelling

Build and sensitise robust cashflow models from scratch, faster in Excel. Hands-on, practitioner-led, in person or online. See dates and book your place.

Problems with VLOOKUP and HLOOKUP

  • The column or row number is typed into the formula. If a column or row is inserted, moved or deleted inside the range, the formula does not adjust: insert a column in the middle of the price data in Figure 1 and every col_index_num after it must be changed by hand
  • VLOOKUP can only search the leftmost column of a range, and HLOOKUP only the top row. If the value you search on sits to the right of the data you want, VLOOKUP cannot be used without moving columns
  • With range_lookup TRUE or left out, the first column or row must be sorted. That is easy to miss, especially for someone who does not know the function well

Replacing VLOOKUP and HLOOKUP with LOOKUP

LOOKUP is cleaner and more transparent: it needs only a lookup value and two ranges.

LOOKUP(lookup_value, lookup_vector, result_vector)

LOOKUP used on the unsorted text list of price cases, returning the wrong case because the list is not in A to Z order
Figure 2: LOOKUP on an unsorted list of price cases returns the wrong case.

LOOKUP is not suitable for the example in Figure 2. The lookup_vector is text and is not sorted from A to Z. When LOOKUP cannot find an exact match it returns the next smallest value, so here it returns the Base case instead of the case selected.

That way of matching is useful elsewhere, though. Where the lookup_vector is a number sorted in ascending order, such as the model timeline running left to right, it keeps the number of inputs down.

LOOKUP returning the price for each period from the Assumptions sheet, using an ascending calendar year counter as the lookup value
Figure 3: LOOKUP with an ascending calendar year counter.

In Figure 3 the lookup_value is a calendar year counter that rises from the start to the end of the model timeline, so LOOKUP returns the right price from the Assumptions sheet.

LOOKUP returning an error during construction, where the operations year counter is zero, and an IF statement that returns zero instead
Figure 4: An IF statement handles a lookup value below the start of the table.

Figure 4 shows what happens when the lookup_value is less than the smallest value in the lookup_vector. Here the lookup_value is the operations year counter, which is zero during construction. The generation per turbine table starts at operations year 1, so LOOKUP returns an error. An IF statement returns zero in those periods instead.

The workbook has further examples of LOOKUP in place of VLOOKUP and HLOOKUP.

INDEX and MATCH where LOOKUP falls short

LOOKUP can replace VLOOKUP and HLOOKUP in many cases, but it returns results from a single row or column. Where the range is not sorted, or the result sits in a two-dimensional table, INDEX and MATCH together are the safer and more flexible choice.

  • INDEX returns the value at a given row and column number: INDEX(array, row_num, column_num)
  • MATCH returns the position of an item in a one-dimensional list: MATCH(lookup_value, lookup_array, match_type). With match_type 0, MATCH finds the first value exactly equal to lookup_value
INDEX and MATCH returning the price for the selected price case: MATCH finds the row of the case and INDEX returns the price from that row
Figure 5: INDEX and MATCH on the price data.

To solve the example with INDEX and MATCH:

  • Use MATCH to find the row number of the Base case, which is 1
  • Use INDEX with that row number to return the price

XLOOKUP in Excel 365

Excel 365 added several new functions, including XLOOKUP. It works much like LOOKUP, with three more inputs: if_not_found, match_mode and search_mode.

XLOOKUP returning the price, with zero entered as the if_not_found value so no IF statement is needed
Figure 6: XLOOKUP with an if_not_found value.

Entering zero in if_not_found removes the need for the IF statement in Figure 4, where the lookup_value is below the smallest value in the lookup_vector.

match_mode has four options, three of which are useful in financial modelling:

  • 0: exact match
  • -1: exact match or the next smallest value
  • 1: exact match or the next largest value

So XLOOKUP with 0 does the job of INDEX and MATCH for an exact match, and with -1 it follows the logic of LOOKUP. It can also return the next largest value where there is no exact match.

LOOKUP questions

Why replace VLOOKUP and HLOOKUP in a financial model?

Their column or row number is typed into the formula, so inserting or moving a column or row can make them return the wrong data without any warning. VLOOKUP can also only search the leftmost column of a range.

When can LOOKUP be used?

When the lookup vector is sorted in ascending order, such as a timeline counter. On an unsorted list it can return the wrong result.

When should I use INDEX and MATCH instead?

When the list is not sorted or the result sits in a two-dimensional table. MATCH with match_type 0 finds an exact match wherever it is.

What does XLOOKUP add?

An if_not_found value, which removes the need for an IF statement around the lookup, and a choice of exact, next smallest or next largest match.

Learn financial modelling in a room

Hands-on courses in person and online, taught to more than 20,000 people on one modelling standard.

Best Practice Project Finance Modelling

Build and sensitise robust cashflow models from scratch, faster in Excel. Hands-on, practitioner-led, in person or online. See dates and book your place.

View full course details: Best Practice Project Finance Modelling

Advanced Project Finance Modelling

Debt sizing, covenant monitoring, DSRAs and integrated three-way statements. Hands-on, practitioner-led training, in person or online. See dates and book.

View full course details: Advanced Project Finance Modelling

Financial Model Review

Error classes, testing technique and where AI-assisted financial model review earns its place. 1-day course from our award-winning Model Audit team.

View full course details: Financial Model Review

Browse all training courses

More on this topic

Tutorials

OFFSET function in Excel

How OFFSET() returns a cell or range a set distance from a reference, the mistakes it invites and how to use it for a DSRA target balance.

Financial modelling of stockpiles in a mining project

LOOKUP at work in a mining model: bring the mining schedule in by year, then build the ore and contained gold stockpile accounts from it.

Services

Financial Model Audit

An independent opinion on the model behind your transaction, with a red flag report on any show-stopper issues in under 5 working days.

Financial Model Development

Project finance models built from first principles for your transaction, structured for lenders to follow and handed over with the logic explained.

Learn to build these models yourself

We run public and in-house courses across the full financial modelling curriculum.