Learn how to look up data to the left with VLOOKUP. Although VLOOKUP can't do this directly, there are two methods.
- Use INDEX and MATCH. This works in all Excel versions but requires complex formulas.
- Use XLOOKUP. XLOOKUP is an improved version of VLOOKUP that can return data from any column, left or right.
Why VLOOKUP Has Limits
The VLOOKUP function only retrieves data to the right of the search ID column. But sometimes, we can't rearrange the columns. For clarity in our example, we need to keep the country name in the first column.
So, how can you create a formula to return a value to the left of the search column?
Method 1: The XLOOKUP function does the job easily
If you work with Excel Online or Excel 365, the easiest way to return a column on the left of the column of research is to use the XLOOKUP function.
- Select the value to research
- Select the column of research (only one column to select)
- Select the column to return whatever if it's on the right or the left of the research's column
=XLOOKUP(G3;tblCountry[ISO 2];tblCountry[COUNTRY])
Method 2: Solution with INDEX and MATCH
If you don't work with Excel 365, there is another technique for returning data on the left. This technique uses the functions INDEX and MATCH together.
- The INDEX function searches for an item in a table in the function of a position (position 1, 2, 3, ...).
- The MATCH function returns the position of a value in a list.
- Then, with this position in the range, INDEX will return the value
Step 1: The position with the MATCH function
The MATCH function returns the position of an item in a list. But let's write this function in a new cell to understand what this function will return.
- The first parameter of the function MATCH is the value we search (the ISO code)
- The second parameter is the column where we look for this value
- We finish the function with 0 or FALSE to indicate that we have performed the exact research. It's exactly like the last parameter of the function VLOOKUP.
=MATCH(G3,$B$2:$B$240,0)
Look at the result of this function for different values of countries. In each case, the function MATCH returns the position in the column B 😎😍👍
Step 2: Include the MATCH inside the INDEX function
Next, insert the result from the MATCH function as the second argument in the INDEX function. This lets us return a value located to the left of the ID 😉
- Write the INDEX function
- Select the range of cells with the countries (column A)
- Copy the MATCH function as second argument of the INDEX function
=INDEX($A$2:$A$233,MATCH($H$3;$B$2:$B$233,0))