GuidesFor beginners

How to use VLOOKUP in Excel: examples, the #N/A error and what to use instead

How to use VLOOKUP in Excel: the function looks up a value by a key in one table and brings back data from a neighboring column. For example, it takes a part number from an order and returns the price from a price list. It saves hours of copying by hand, and most of its errors come from the data, not from the formula.

By TASE TeamPublished 6 min read

How to use VLOOKUP in Excel: two glass tables joined by a cyan lookup line and a golden eye ring
On this page
  1. What VLOOKUP does in Excel
  2. The four arguments in plain words
  3. An example with two tables
  4. Why you need to lock the range
  5. The #N/A error: why it happens and what to do
  6. Exact versus approximate match
  7. VLOOKUP's limits
  8. INDEX and MATCH: when you need to look left
  9. XLOOKUP: the modern replacement
  10. The same in Google Sheets
  11. A spreadsheet and the TASE dashboard
  12. What to do today
  13. Frequently asked questions

What VLOOKUP does in Excel

A price list of 300 items, an orders table of 50 rows. You can hunt for each price by eye and retype it. Or you can write one formula and drag it down.

That's what VLOOKUP does. The name stands for "vertical lookup": it walks down the first column of a table, finds the value you want and takes data from the same row but a different column. In Google Sheets it has the same name.

It's a built-in worksheet function, so there's nothing to install: it works in any Excel file you already have.

The four arguments in plain words

The formula looks like this: =VLOOKUP(lookup value, range, column number, FALSE). Each part means one thing.

  • Lookup value. The cell with the key, for example a part number in an order.
  • Range. The table range. The key must sit in the very first column of this range.
  • Column number. Which column of the range to return, counted from the start of the range, not from the sheet.
  • FALSE (or 0). You need an exact match. If you put TRUE or skip the argument, Excel looks for an approximate match, which often gives a wrong result.

The separator between arguments depends on regional settings: in the US version it's usually a comma, in some other regions a semicolon. If the formula is rejected, try the other one.

An example with two tables

Sheet "Prices": part numbers in column A, prices in column B. A-101 costs 250, A-102 costs 410, A-103 costs 90. Sheet "Orders": part number in column A, quantity in column B, and column C needs the price.

In cell C2 write: =VLOOKUP(A2, Prices!$A$2:$B$100, 2, FALSE). If A2 holds A-102, the formula finds that row in the price list and returns 410. The 2 means "take the second column of the range".

Now the total: three pieces at 410 is 1,230, two pieces of A-101 at 250 is 500, ten pieces of A-103 at 90 is 900. Overall 1,230 + 500 + 900 = 2,630. Not one price typed by hand.

How VLOOKUP works in Excel: a key from orders finds a row in the price list and brings back the value from a neighboring column
VLOOKUP takes the key from an order, finds the row in the price list and returns the price from the right column.

Why you need to lock the range

You drag the formula down, and by row ten the price suddenly isn't found. Sound familiar? A relative reference is to blame: when you copy the formula, the range shifts down a row, and the top rows of the price list fall out of it.

The fix is simple. Dollar signs in the range address ($A$2:$B$100) pin it in place. On Windows, pressing F4 while editing a reference adds them quickly. The key in the first argument (A2) stays without dollars so it changes from row to row.

The #N/A error: why it happens and what to do

#N/A means "not available": Excel didn't find the key. The cause is nearly always in the data itself.

  • Stray spaces. "A-102 " with a trailing space and "A-102" are different keys to Excel. Check text length with LEN and remove extra spaces with TRIM.
  • Number versus text. The price list has 1001 as a number, the order has "1001" as text (common after an export from another program). They look identical and search differently. Make both columns the same type.
  • A typo or a lookalike letter. A Latin A and a lookalike letter from another alphabet look the same on screen.
  • The key really isn't there. Then #N/A is an honest answer.

To keep a tidy table from filling up with errors, wrap the formula in IFERROR: =IFERROR(VLOOKUP(...), "not in price list"). But don't hide errors for good: find the cause first, or you'll lose a line item you simply didn't find.

Exact versus approximate match

With FALSE, VLOOKUP looks for an exact match. With TRUE it finds the closest smaller value, which suits scales: discounts, tax brackets, grades.

Example. A discount table: from 0 a 0% discount, from 1,000 a 5% discount, from 5,000 a 10% discount. The order total is 2,630. A formula with TRUE finds the nearest threshold not above 2,630, which is 1,000, and returns 5%. The discount is 2,630 x 5% = 131.5, so the amount due is 2,630 - 131.5 = 2,498.5.

There's a strict condition: the first column of the discount table must be sorted ascending. Otherwise the result is random. So for ordinary lookups by part number, always use FALSE.

VLOOKUP's limits

  • The key must be on the left. You can search only in the first column of the range and return data to the right. VLOOKUP can't fetch a value to the left of the key.
  • The column number is hard-coded. Insert a new column into the table and the 2 in the formula starts pointing at different data.
  • It finds only the first match. If the key repeats, you get data from the first row found.
  • It can't search by two conditions. For that you need a helper column or another function.

These limits don't make VLOOKUP bad. For the typical "price list and orders" job it's enough. But when the job is broader, there are better options.

INDEX and MATCH: when you need to look left

A pair of functions does what VLOOKUP does without its limits. MATCH finds the row number where the key sits, and INDEX uses that number to pull a value from any column.

The formula: =INDEX(Prices!$B$2:$B$100, MATCH(A2, Prices!$A$2:$A$100, 0)). The zero at the end means an exact match, like FALSE in VLOOKUP. The key column and the result column are given separately, so the order in the table doesn't matter, and inserting a new column breaks nothing.

It's longer to write, and beginners find it harder. But if you edit tables often, getting used to this pair saves nerves.

XLOOKUP: the modern replacement

Excel 2021 and Microsoft 365 added the XLOOKUP function. It looks for a key in one range and returns data from another, searches in either direction, makes an exact match by default and can show your own text if nothing is found.

The formula: =XLOOKUP(A2, Prices!$A$2:$A$100, Prices!$B$2:$B$100, "not in price list"). It doesn't exist in older Excel versions (such as 2016), and a file with such a formula opens with errors. If colleagues with older versions will open the table, VLOOKUP or INDEX with MATCH is the safer choice.

The same in Google Sheets

In Google Sheets VLOOKUP works the same way: the same four arguments, the same logic. Differences are small: data from another file is pulled in with IMPORTRANGE, and newer versions have an XLOOKUP counterpart too.

If you move a formula between Excel and Sheets, check the argument separator and the function language. Names like VLOOKUP translate, text in quotation marks doesn't.

For tables where the data also gets calculated, the article on percentages comes in handy, and for date planning there's a piece on the Gantt chart. And if the table tracks household spending, see the article on a family budget.

A spreadsheet and the TASE dashboard

A spreadsheet pulls data in by a key on its own, so you don't have to keep records by hand. TASE shows positions in the dashboard on the same principle. It's an automated trading system built on proprietary algorithms and machine learning, with an independent AI module that checks each signal, and it trades futures on Binance, Bybit, OKX and BingX around the clock. The API key is issued for trading only, with no withdrawal rights, and every position is visible in the panel. Accounts start at $10,000. More in the transparency section. Exchange availability depends on your country, so check the terms before registering.

What to do today

Take any table of yours where you hunt for a price, a name or a code by eye, and write one VLOOKUP formula for it with FALSE and a locked range. If #N/A pops up, check spaces and data type first, and only then rewrite the formula. When a spreadsheet fills up with customers, it's time to look at a CRM system.

Educational material. Function names and separators depend on the Excel version and language; check the help for your version.

Frequently asked questions

What is VLOOKUP in Excel?

It is a vertical lookup function. It searches the first column of a table for a key and returns a value from another column of the same row, for example the price for a part number. In some Excel languages it has a translated name.

How do you use VLOOKUP?

Write =VLOOKUP(lookup value, range, column number, FALSE). Lock the range with dollar signs, and keep the key in the first column of the range. FALSE means an exact match, and it is best to always use it unless you need a scale.

Why does VLOOKUP return #N/A?

Most often the key is not found because of stray spaces, numbers stored as text or a typo. Check value length with LEN, remove spaces with TRIM and make both columns the same data type.

What is the difference between TRUE and FALSE in VLOOKUP?

FALSE looks for an exact match. TRUE finds the closest smaller value and requires the first column to be sorted ascending. It is used for scales such as discounts or rates, not for lookups by part number.

What can replace VLOOKUP?

The INDEX and MATCH pair, which can look to the left and does not break when columns are inserted, or XLOOKUP in Excel 2021 and Microsoft 365. Older Excel versions do not have XLOOKUP.

Does VLOOKUP work in Google Sheets?

Yes, it works the same way: the same four arguments and the same logic. Other files are connected with IMPORTRANGE. When moving a formula between Excel and Sheets, check the argument separator and the function language.

About the author

TASE Team · Editorial team

The TASE team builds an automated crypto trading system with its own algorithms and machine learning. We write about what we know from engineering and risk work, and we label opinion as opinion.

Educational content, not investment advice. Trading crypto and derivatives carries a high risk of losing all invested capital.

Explore TASE