VLOOKUP in Excel: what it does, when to use it, and the pitfalls
VLOOKUP really does just one job, and it does it well: it searches for a value in the leftmost column of a range and hands you back a value from another column on that same row. Type a product code, get the stock level. Type a customer number, get the name. Once that idea clicks, you can see at a glance what the function was built for and where it starts to fall apart.
Most guides jump straight to the buttons: which brackets, which argument goes where. I would rather turn that around. More useful than the exact order is knowing when you actually need VLOOKUP, when the newer XLOOKUP is the smarter pick, and which mistake nearly everyone makes at least once. Get that clear first, and the formula itself becomes logical instead of a sequence you memorise and forget a week later.
What does VLOOKUP actually do?
Picture two lists that have something in common. One is a sales export with nothing but product codes; the other is a long reference table with codes plus the matching names and prices. You want the right name from the second list next to every code in the first, without lining up hundreds of rows by hand. That is exactly the work VLOOKUP was made for: it links two tables automatically through a shared key.
The function takes the value you know, scans down the first column of the range you point it at, and returns the value sitting on that same row in a column of your choosing. One detail decides almost everything that goes wrong later: VLOOKUP always looks to the right. The column you search in must be the leftmost one in your range, and the answer has to sit to the right of it. That is not a setting you can flip, it is how the function is built.
The name gives away half the story. The V stands for vertical: you search top to bottom through a column. There is a sister function that does the opposite and scans horizontally across a row, but you rarely meet it in practice, because data almost always sits in columns stacked underneath each other rather than in rows side by side. Once you notice that, it is obvious why VLOOKUP turns up so much more often than its horizontal cousin: it simply matches the way most people build a table.
What four things does the formula ask for?
Under the hood VLOOKUP asks for four pieces of information, and it helps to read them not as code but as four plain questions you are answering.
- The lookup value: what are you searching for? Usually a cell with a code, a name or a number.
- The table range: which table should be searched? Remember that the search column sits on the left.
- The column index number: counting from the left inside that range, which column holds the answer?
- Approximate or exact: choose FALSE for an exact match. That is what you want in almost every case.
That last argument is the quiet culprit behind a lot of odd results. Leave it out or set it to approximate, and Excel assumes your column is sorted in ascending order and grabs the closest value that is not larger. When you are matching an exact code or name, that is rarely what you meant. Hence the rule of thumb: put FALSE, unless you very deliberately want an approximation, for instance when sorting values into price brackets or grade bands.
When VLOOKUP is the right call, and when it is not
VLOOKUP comes into its own the moment you need to tie two data sources together through a shared attribute. Matching an accounting export to your own price list. Enriching a list of email addresses with the name that belongs to each. Turning attendance records into departments. In all of those you have a key that shows up in both lists, and you want to pull in the rest of the row. That is the core task, and for it the function is fast, dependable and easy to explain to a colleague.
There is one place where approximate matching is genuinely useful, and it often gets forgotten: sorting values into bands. To find the right discount tier for an amount, or the right grade for a score, you set up a table of lower bounds in ascending order and let VLOOKUP grab the nearest value below. In that case approximate is precisely what you mean. Outside those threshold tables, though, FALSE stays the safe default.
There are also situations where you are better off not reaching for it. If the answer sits to the left of your search column, you are stuck: VLOOKUP cannot look left. If the layout of your source changes regularly, the column index number becomes a weak spot, because an inserted column shifts everything along and your formula suddenly points to the wrong place. And if you need to match on two attributes at once, say a name within a particular branch, VLOOKUP quickly turns into a workaround. For those jobs there is better tooling, which I will come back to shortly.
A worked example with a small table
An example makes it concrete. Say you have a small stock list with a code, a product name and the quantity on hand. You want to know how many units of code A-102 are in stock, without reading down the list yourself.
| Code | Product | Stock |
|---|---|---|
| A-101 | Keyboard | 24 |
| A-102 | Mouse | 60 |
| A-103 | Webcam | 12 |
What happens here is that the formula looks up “A-102” in the Code column, finds the row it sits on, and then returns the third column of the range: the stock, 60. Want the product name instead? Put a 2 where the column index number goes. Notice what you cannot do: if all you had was the number 60 and wanted the matching code, this layout will not deliver it, because the code sits to the left of the stock. That is the left-hand limit in practice.
In real work you rarely type the lookup value straight into the formula. You point at a cell, say a field where someone types a code, so the answer updates the moment that code changes. If you then copy the formula down a whole list, lock the table range with dollar signs, A$2:C$4 instead of A2:C4. Forget that, and the range slides down with every row, dropping the top lines out of view. It is a small detail that causes a surprising number of errors for people who are sure their formula is right.
The pitfalls: #N/A and looking left
The error you will meet sooner or later is #N/A, short for “not available”. With it Excel is being honest: I did not find the value you asked for. Annoying, but genuinely helpful, because it almost always means something small is off rather than something big. The trick is not to panic and rewrite the whole formula, but calmly walk through the usual handful of causes.
Why do you get #N/A?
The first cause is the most literal: the value really is not in the search column. Often it is subtler. A trailing space after the code that your eye cannot see, a 0 stored as text in one table and as a number in the other, or a typo in the lookup value. A second common mistake is a wrong column index number, so you point at a column that falls outside your range. A third is that your range does not begin at the search column, so Excel is looking in the wrong place.
And then there is the limitation that is not a bug but a boundary: VLOOKUP can only look right, never left of the leftmost column. Anyone whose table is arranged so the answer sits to the left of the key can twist as much as they like, it will not work. At that point it is wiser to reorder the table or to use a function that does not have this boundary. Which is exactly where XLOOKUP enters the picture.
VLOOKUP or XLOOKUP?
XLOOKUP is the newer successor, and on the points where VLOOKUP struggles it is simply better. It can look left, because you point separately at where you search and where the answer sits. It needs no column index number, so an inserted column no longer breaks your formula. And it defaults to an exact match, so the classic trap of the forgotten FALSE argument disappears. For anyone starting today, XLOOKUP is often the calmer choice.
You see the difference clearly if you redo the same example. Where VLOOKUP still made you supply the range and a column number 3, XLOOKUP has you point at two things separately: the column you search in and the column you pull the answer from. Move a column later, or insert one, and it keeps working, because there is no fragile position number left that could point to the wrong place. That makes formulas meant to last for months a good deal less error-prone, which is exactly the kind of work where VLOOKUP eventually starts to creak.
There is one condition attached. XLOOKUP is available in Microsoft 365 and in Office 2021 and newer. If you work with an older Office version, the function simply is not there and VLOOKUP stays the tool you have. If you share a file with someone still on such an older version, there is another reason to stick with VLOOKUP, because an XLOOKUP formula shows them an error. My advice is sober: if you have 365 or Office 2021, learn XLOOKUP and keep VLOOKUP only where your files would otherwise stop being compatible.
Which Excel do you need for this?
Both functions live in the same Excel, which you can have in two ways. The first is Microsoft 365, the subscription you pay for by the year or the month and that always ships the latest version. The second is Office 2021, which you buy once and which keeps working without any ongoing payment. Both contain an Excel that knows VLOOKUP as well as XLOOKUP, so for these functions you do not necessarily have to pick the subscription.
Which of the two suits you depends on how you work, not on which function you use. If you want the newest features and the cloud services around them, the subscription is the natural fit; I unpack that choice further in what is Microsoft 365. If Excel as it is now is plenty and you would rather pay once, the one-off purchase usually works out cheaper over several years. I put the two routes side by side in Office 365 versus Office 2021.
Keeping it manageable
If you take away only one habit, make it this: default to FALSE for an exact match and treat approximate as the exception, not the norm. That heads off the bulk of the quiet errors where a formula does return an answer, only the wrong one. Give your ranges a name as well, instead of a bare stretch of cells, and you can read back later what a formula does, with nothing shifting when you insert a column.
And when you notice you are bending VLOOKUP to look left or to match on two attributes, take that as a signal. It is not a sign that you do not understand the function, but that you are hitting its boundary. If you have an Excel with XLOOKUP, switch over for that one case; if you do not, reorder your table so the key sits on the left. That keeps the function doing what it is good at, and saves you an afternoon lost to a formula that was never going to work.
Buying software the smart way?
Explore our genuine licences with instant delivery and support.