You can use the INDEX function and the MATCH function together instead of the VLOOKUP function
For example, there is data as shown below.
How much you have to pay for all tall orders?
The first step to calculate all total bills is to find the price of each drink. Usually, the VLOOKUP function is used to find the prices, for now, it will use the INDEX MATCH formula.
Let’s start with the MATCH function first, to find the position of each drink name in the price table.
After the position of each drink name is known, it’s time to retrieve the price of each drink. Drink prices for all sizes are in range B2:D13, by using the results of the MATCH function in column_num argument, the INDEX function can retrieve the price for each drink.
Use the SUMPRODUCT function to calculate the total bill in cell H9.
The array argument of the INDEX function uses absolute reference; the reason is the same as the lookup_array argument of the MATCH function using an absolute reference.
All orders have the same size, Tall, so the column_num argument of the INDEX function is filled with number 1, the column position in range B2:D13 which contains the price of drinks for Tall size.
What if the drink order has different sizes as shown below?
It’s time to use the INDEX MATCH MATCH formula.
If the size of the ordered drink varies, then you need one more MATCH function to determine the position of the size of the drink ordered. The additional MATCH function will fill the column_num argument of the INDEX function.
The lookup_value argument of the MATCH function point to cell G4, containing the size of the drink ordered — the lookup_array argument point to range B1:D1 which contains information of all drink sizes and uses an absolute reference.
The result is as shown below.
Lookup direction after lookup_value found
The VLOOKUP limitation is just looked to the right column to retrieve the result value. No VLOOKUP to the left, instead the INDEX MATCH formula can do lookup to the right or lookup to the left.
This limitation occurs because the VLOOKUP lookup_value requires to be positioned in the first column of table_array while INDEX MATCH lookup_value can be positioned anywhere.
Number of match type
The VLOOKUP function has two match type, Exact (FALSE) and Approximate (TRUE). If using approximate match type, the first column of table_array must be sorted in ascending order.
The INDEX MATCH formula has three match type, Exact (0), Less than approximate (1) and greater than approximate (-1).
If you use less than approximate (1) the lookup_array argument must be sorted in ascending order, whereas if you use a greater than approximate (-1) lookup_array must be sorted in descending order.
The INDEX MATCH formula has more choice of match type, more flexible with various data conditions.