Excel guide · 5 min read
How to look up a value to the left in Excel
=XLOOKUP(G1,D2:D9,A2:A9) searches the badge IDs in column D and returns the name from column A. In Excel 2019 and older, use =INDEX(A2:A9,MATCH(G1,D2:D9,0)), which works in every version.Sample data
Every result on this page was calculated from this sheet by the same spreadsheet engine the Cellwise app uses.
| A | B | C | D | E | F | G | |
|---|---|---|---|---|---|---|---|
| 1 | Name | Dept | Start date | Badge ID | Find badge | B-2207 | |
| 2 | Maria Lopez | Finance | Apr 15, 2019 | B-1042 | |||
| 3 | Sam Patel | IT | Aug 2, 2021 | B-1187 | |||
| 4 | Jo Kim | Sales | Jan 10, 2022 | B-2207 | |||
| 5 | Priya Shah | HR | Nov 26, 2018 | B-2231 | |||
| 6 | Tom Reyes | IT | Mar 6, 2023 | B-3015 | |||
| 7 | Lakshmi Iyer | Sales | Jun 22, 2020 | B-3090 | |||
| 8 | Ben Carter | Finance | Sep 9, 2024 | B-3144 | |||
| 9 | Ana Costa | Sales | Feb 17, 2025 | B-4021 |
Download this sheet as an Excel practice file (.xlsx)
Why VLOOKUP cannot look left
The staff list has the badge ID in the last column, D. Someone hands you badge B-2207 and wants the name. VLOOKUP always searches the first column of the table you give it and returns a column counted to the right of it. With the table starting at D, there is nothing to the right to return. A table starting at A searches the names, not the badges.
A negative column number does not reverse the direction. It returns #VALUE!, because the column number must be 1 or more.
Result: #VALUE!
#VALUE!. VLOOKUP's third argument has to be 1 or more, so it can never reach a column on the left.
Method 1: XLOOKUP (Excel 365, 2021 and later)
XLOOKUP takes the column to search and the column to return as two separate ranges, so their order on the sheet does not matter. Search D2:D9, return A2:A9. It is an exact match by default, so there is no FALSE to forget.
Add a fourth argument for a friendlier result when the badge does not exist: =XLOOKUP("B-9999",D2:D9,A2:A9,"No such badge") returns No such badge instead of #N/A. Change the return range to C2:C9 to get the start date, Jan 10, 2022 once formatted as a date. To bring back several columns at once, give it a wider return range; the guide on returning multiple columns covers that.
Result: Jo Kim
Jo Kim, the name three columns to the left of badge B-2207.
Method 2: INDEX and MATCH (every version)
MATCH finds the position of the badge in D2:D9: B-2207 is third. INDEX returns the third cell of A2:A9. Because the two ranges are separate, INDEX can point left, right or at another sheet. The 0 at the end of MATCH means exact match; leave it out and MATCH does an approximate match, which on unsorted IDs returns wrong names.
Use this when anyone opening the file has Excel 2019 or older, where XLOOKUP returns #NAME?. For a "not found" message, wrap it: =IFERROR(INDEX(A2:A9,MATCH("B-9999",D2:D9,0)),"No such badge").
Result: Jo Kim
Jo Kim, the same answer as XLOOKUP.
The gotcha: ranges that start on different rows
Both methods return the item at the same position in the return range as the match in the search range. If the ranges start on different rows, you get the wrong row with no error. Here the return range includes the header row, so position 3 is A3, Sam Patel, not Jo Kim.
This happens when you select a column with its header for one range and without it for the other, or when you fill a formula down without $ signs and the ranges slide. Press F2 and check that the coloured boxes start and end on the same rows. Ranges of different sizes give #VALUE! in XLOOKUP but INDEX/MATCH can still return a wrong answer, so check INDEX/MATCH especially.
Result: Sam Patel
Sam Patel. Wrong: B-2207 belongs to Jo Kim. With A2:A9 the answer is correct.
Other workarounds, and why to skip them
Move the column. If you own the sheet, cutting the badge column and inserting it before the names lets a plain VLOOKUP work. That is fine for a one-off, but other people's formulas and reports may depend on the column order, and VLOOKUP's column number breaks again whenever someone inserts a column inside the table.
The CHOOSE trick. Older forum answers build a reordered table on the fly: =VLOOKUP(G1,CHOOSE({1,2},D2:D9,A2:A9),2,FALSE). It is valid Excel, but it is hard to read and harder to edit, and INDEX/MATCH does the same job in every version. In Excel 365, HSTACK(D2:D9,A2:A9) can replace CHOOSE, but XLOOKUP is still shorter.
A helper column. Add a column to the right of the badges that repeats the name with =A2, then VLOOKUP into it. It works, but it duplicates data that can go stale.
Duplicates: which match comes back
Every method above returns the first match from the top. Looking up the department Sales to the left returns the first Sales person, Jo Kim, even if you wanted the most recent hire. XLOOKUP can search from the bottom with -1 as its sixth argument. To get every match, use FILTER; the guide on returning multiple values shows how.
Result: Ana Costa
Ana Costa, the last Sales row. Without the -1 the result is Jo Kim.
Which method to pick
Everyone has Excel 365, 2021 or later: XLOOKUP. It is the shortest, has a built-in not-found value and can search from the bottom. The file is shared with people on Excel 2019 or older: INDEX/MATCH, which also keeps working when columns are inserted. Avoid the CHOOSE trick and avoid moving columns in a shared file. Whichever you use, put the value you look up in a cell, as in G1, rather than typing it into the formula.
Common mistakes
Trying a negative column number in VLOOKUP
It returns #VALUE!. VLOOKUP only returns columns to the right; switch to XLOOKUP or INDEX/MATCH.
Leaving out the 0 in MATCH
Without it MATCH does an approximate match, which on unsorted IDs returns a nearby row instead of #N/A. Always write MATCH(value,range,0) for IDs and names.
Search and return ranges that start on different rows
The result comes from the wrong row with no error. Make both ranges start and end on the same rows, and lock them with $ before filling down.
Using XLOOKUP in a file for Excel 2019 users
They see #NAME?. Use INDEX/MATCH when you cannot be sure of the version.
FAQ
Can VLOOKUP look to the left?
Not on its own. VLOOKUP searches the first column of its table and returns columns to the right. The CHOOSE trick can fake it, but XLOOKUP or INDEX/MATCH are simpler and more reliable.
What is the best formula to look up to the left?
XLOOKUP if you have Excel 365 or 2021 and later: =XLOOKUP(value,search_column,return_column). Otherwise INDEX/MATCH: =INDEX(return_column,MATCH(value,search_column,0)).
Can XLOOKUP return a value from a column to the left?
Yes. The search and return ranges are separate arguments, so the return column can be anywhere: left, right or on another sheet, as long as both ranges have the same rows.
Does HLOOKUP have the same problem?
Yes. HLOOKUP searches the top row and only returns rows below it. XLOOKUP and INDEX/MATCH work across rows too, so they can return a row above the one you search.
Functions used
VLOOKUPVertical lookupXLOOKUPModern lookup in any directionINDEXValue at a positionMATCHPosition of a valueIFERRORFallback when a formula errorsFILTERKeeps matching rows, spills
Related guides
- How to use INDEX MATCH in Excel
- VLOOKUP vs XLOOKUP
- INDEX MATCH vs XLOOKUP
- VLOOKUP not working: 7 causes and fixes
- Excel formulas cheat sheet: the 25 everyone should know
- XLOOKUP not working: how to fix #N/A and wrong results
- How to find the closest match in Excel
Updated