Skip to content

All-Access: every lesson, no ads. $8.25€8.25US$8.25$4.08US$4.08$2.41US$2.41₹224.91MX$74.91 a month, billed yearly. Free to start. Cancel any time

See plans
All-Access, no ads: every lesson, course and template. $8.25€8.25US$8.25$4.08US$4.08$2.41US$2.41₹224.91MX$74.91 a month. + GST at checkoutSee the plans →

Functions

VLOOKUP Function in Excel: Syntax, Examples, Errors

By the LogicExcel Editorial Team19 min read3,631 wordsPractice this

VLOOKUP searches the first column of a range for a value and returns something from the same row. To get the name for the staff ID in G2, type =VLOOKUP(G2,A2:E7,2,FALSE). Excel looks down column A, finds the row, and returns the entry in column 2 of the range. The FALSE at the end forces an exact match, which is what you want almost every time.

Try this now

VLOOKUP, or Vertical Lookup, finds a value in a vertical list and returns the corresponding value in an adjacent vertical list. Get the year of hurricane Ike by looking up "Ike" in the table A1:B4 and returning its second column, with an exact match (the last argument is 0).
ABCD
1NameYear
2Ike2008
3Sandy2012
4Harvey2017
5
D5fx

You are typing into D5. Refer to the cells that hold the data.

Continue the full lesson →

Ready to practice?

Apply what you just learned with interactive exercises.

Start Lesson 11

This guide covers the Excel VLOOKUP function from the first formula to the traps that cause wrong answers: the left-column rule, approximate match for tiers, lookups from another sheet, matching on two criteria with a helper column, the errors you will see and when to switch to XLOOKUP. Every VLOOKUP example runs on one staff sheet, so you can type it in and compare each result.

TL;DR

  • The VLOOKUP formula is =VLOOKUP(lookup_value, table_array, col_index_num, [range_lookup]).
  • The value you search for must be in the first column of table_array. VLOOKUP cannot look to the left of it.
  • The column number counts from the first column of your range, not from column A of the sheet.
  • Always type FALSE (or 0) for an exact match. Leave it off and Excel does an approximate match that can return a wrong row without any error.
  • For two criteria, join them into a helper column and look up the joined value, or use SUMIFS when the answer is a number.
  • If everyone has a current Excel, XLOOKUP avoids most VLOOKUP mistakes.

Table of Contents

The sample data used in every example

You are an HR clerk with a small staff list. Type this into a blank sheet starting at A1.

RowABCDE
1IDNameDepartmentGradeMonthly salary
24101Lerato DlaminiFinanceB42000
34102Pieter van WykLogisticsC31500
44103Aisha KhanFinanceA58000
54104Sipho NkosiSalesB39000
64105Megan JacobsSalesC33500
74106Johan BothaLogisticsB36000
The two lookup inputs sit to the right.
RowGH
1Staff IDName typed
24104Megan Jacobs
IDs are real numbers, not text. That detail causes a surprising share of problems, so keep it in mind. Two further small tables appear later, each printed where it is used.

VLOOKUP syntax and arguments

=VLOOKUP(lookup_value, table_array, col_index_num, [range_lookup])

ArgumentRequiredWhat it does
lookup_valueYesThe value to find. A cell, a number, or text in quotes.
table_arrayYesThe range that holds both the value you search for and the value you want back.
col_index_numYesWhich column of table_array to return. 1 is the first column of your range.
range_lookupNoFALSE or 0 for an exact match. TRUE, 1 or left out for an approximate match.
Three rules sit behind that table.
  1. The search always happens in the first column of table_array. If your lookup value lives in column C, the range must start at C.
  2. col_index_num counts inside the range. In B2:E7, column B is 1, C is 2, D is 3 and E is 4. Counting from the sheet's column A is the classic wrong turn.
  3. range_lookup defaults to approximate. This is a dangerous default, so VLOOKUP formulas in real workbooks nearly always end in FALSE.
VLOOKUP ignores case, so "sipho nkosi" matches "Sipho Nkosi". It returns the first match when there are duplicates.

VLOOKUP examples from simple to advanced

Each example below runs on the staff sheet and shows the result you should see, so you can compare it with your own. Every lookup has the same four parts: the value, the range, the column number and the match type. If you want a slower click-by-click walkthrough of the dialog box, our step-by-step VLOOKUP tutorial covers that. This page is the reference.

How to find a name from an ID

The classic sample: the ID is in G2 and you want the person's name.

=VLOOKUP(G2,A2:E7,2,FALSE)

Excel finds 4104 in A5, the fourth row of the range, and returns column 2 of that row, which is Sipho Nkosi.

How to return a different column

Only the column number changes when you want another field for the same person.

=VLOOKUP(G2,A2:E7,3,FALSE) returns Sales, the department.

=VLOOKUP(G2,A2:E7,5,FALSE) returns 39000, the monthly salary.

Hardcoding 5 works until someone inserts a column. A sturdier version asks MATCH to find the column by its heading:

=VLOOKUP(G2,A1:E7,MATCH("Monthly salary",A1:E1,0),FALSE)

This still returns 39000, and it keeps working when columns move because MATCH recalculates the position. Notice the range now starts at row 1 so the heading row is included for MATCH.

How to look up by name text

Lookups by text work the same way, with two cautions. The text goes in quotes, or comes from a cell. And the name must be in the first column of the range, so start the range at column B:

=VLOOKUP(H2,B2:E7,4,FALSE)

H2 holds Megan Jacobs, which sits in the first column of B2:E7. Column 4 of that range is E, so the result is 33500.

The text must match the cell as written. =VLOOKUP("Megan",B2:E7,4,FALSE) returns #N/A because no cell says only "Megan". If you only know the start of a name, add a wildcard: =VLOOKUP("Sip*",B2:E7,4,FALSE) returns 39000. The * stands for any number of characters, and our wildcard characters guide lists the others.

Why VLOOKUP cannot look left

Suppose you hold the name in H2 and want the ID, which sits to the left of it. This fails:

=VLOOKUP(H2,A2:B7,1,FALSE)

Excel searches column A, where names do not appear, and returns #N/A. The fix is not a smarter column number. VLOOKUP only returns columns at or to the right of the search column. Use INDEX and MATCH instead:

=INDEX(A2:A7,MATCH(H2,B2:B7,0))

That returns 4105. Our INDEX MATCH guide explains the pair, and XLOOKUP does the same job as =XLOOKUP(H2,B2:B7,A2:A7).

How to find the first row for a department

Departments repeat, so VLOOKUP returns the first one it meets. Start the range at the department column:

=VLOOKUP("Finance",C2:E7,3,FALSE)

It returns 42000, the salary of Lerato Dlamini in row 2, because she appears before Aisha Khan. When duplicates matter, add a second criterion (see below) or use a function that can list every match, such as FILTER.

How to show a message instead of #N/A

An ID that is not on file returns #N/A:

=VLOOKUP(4199,A2:E7,2,FALSE)

Wrap it in IFNA to show a message for that case only:

=IFNA(VLOOKUP(4199,A2:E7,2,FALSE),"Not on file")

The result is "Not on file". IFERROR does the same job but also hides a #REF! caused by a bad column number, so you would never learn the formula is broken. Prefer IFNA when a missing item is the only thing you expect to go wrong:

=IFERROR(VLOOKUP(4199,A2:E7,2,FALSE),"Not on file") shows the same text but swallows every error type.

Exact match or approximate match

The fourth argument decides how the search works, and mixing the modes up produces the quiet kind of error.

Exact match (FALSE or 0) looks for the value and returns #N/A if it is missing. Use it for IDs, names, codes and anything where the answer should exist.

Approximate match (TRUE, 1 or omitted) looks for the largest value that is less than or equal to your lookup value. It needs the first column sorted from smallest to largest. Use it for bands such as commission rates, grades and tax brackets.

Here is a commission table. Type it into a new area starting at A1, with the sales figure in D2.

RowABCD
1Sales fromRateSales
200%135000
3500002%
41000004%
52000006%
The sample for approximate match:

=VLOOKUP(D2,A2:B5,2,TRUE)

135000 is not in the list. The largest value that does not exceed it is 100000, so the formula returns 0.04, or 4% once the cell is formatted as a percentage. Leaving off TRUE gives the same result, =VLOOKUP(D2,A2:B5,2), because approximate is the default. Switch to FALSE and the same lookup returns #N/A, since 135000 is not listed exactly:

=VLOOKUP(D2,A2:B5,2,FALSE)

Two edge cases to remember:

  • A value smaller than the first row returns #N/A. =VLOOKUP(-5,A2:B5,2,TRUE) has nowhere to land.
  • A value larger than the last row returns the last row. =VLOOKUP(250000,A2:B5,2,TRUE) returns 0.06.
The silent danger is leaving off the fourth argument on a lookup that should be exact. On the staff sheet, =VLOOKUP(4199,A2:E7,2) does not return #N/A. It returns Johan Botha, because the IDs are sorted and 4199 is larger than the last one. An ID that does not exist is paid to someone else. Typing FALSE removes that risk.

If the first column is not sorted, an approximate match can return a wrong row with no warning at all. Sort first, or use exact match, or use =XLOOKUP(D2,A2:A5,B2:B5,,-1), which does not need a sorted list.

VLOOKUP with multiple criteria

VLOOKUP checks one column, so to match on two things you build a single key that joins them. This is the standard way to do VLOOKUP with multiple criteria.

Here is a sales table where the first column is a helper key. Column A holds the formula, copied down.

RowABCD
1KeyRegionProductUnits
2North-TeaNorthTea120
3North-CoffeeNorthCoffee95
4South-TeaSouthTea80
5South-CoffeeSouthCoffee140
6East-TeaEastTea60
7East-CoffeeEastCoffee75
The inputs are the region in F2 (South) and the product in G2 (Coffee).
  1. Build the key. In A2 type =B2&"-"&C2 and fill it down. The dash keeps two different pairs from producing the same text, such as "A" with "BC" and "AB" with "C".
  2. Look up the joined value. In H2 type =VLOOKUP(F2&"-"&G2,A2:D7,4,FALSE). It builds "South-Coffee", finds it in A5 and returns column 4, which is 140.
The helper column must be the first column of the table_array, so the key sits in A and the range starts at A. That is the reason this method is clumsy, and why people move to XLOOKUP, which can join the lookup arrays inside the formula. See XLOOKUP with multiple criteria.

When the value you want is a number you are adding up, skip the helper column altogether:

=SUMIFS(D2:D7,B2:B7,F2,C2:C7,G2)

That also returns 140 and accepts as many criteria as you like. Our SUMIFS guide shows the pattern. Keep VLOOKUP for text answers such as a name, a status or a category.

VLOOKUP from another sheet

Looking up from another sheet changes only the range. Click the other sheet's tab while you build the formula and Excel writes the sheet name for you. If your rate card sits on a sheet called Rates with IDs in column A and the monthly rate in column C, the formula on the staff sheet looks like this:

=VLOOKUP(A2,Rates!$A:$D,3,FALSE)

The range Rates!$A:$D is the whole of columns A to D on the Rates sheet, with the dollar signs locking it when you fill down. If the sheet name contains a space, Excel wraps it in single quotes, as in 'Rate Card'!$A:$D. The same rules apply as on one sheet: the ID must be in the first column of the range, and the column number counts inside the range. Our absolute reference guide explains why the dollar signs matter.

The most common reason a VLOOKUP from another sheet fails is a mismatch in how the key is stored. One sheet has the ID as a number and the other as text. Check both columns with ISNUMBER before you hunt anywhere else.

VLOOKUP vs XLOOKUP, HLOOKUP and INDEX MATCH

QuestionVLOOKUPXLOOKUPINDEX MATCHHLOOKUP
DirectionDown a columnEitherEitherAlong a row
Return left of the keyNoYesYesNot applicable
Default matchApproximateExactExact with 0Approximate
Survives an inserted columnOnly with a MATCH column numberYesYesOnly with a MATCH row number
Excel versionsAll2021 and later, Microsoft 365AllAll
Use VLOOKUP when the sheet already uses it, the data is laid out left to right with the key first, and the file may open in an older version. Use XLOOKUP in new work for current versions. Use INDEX MATCH when you need a left lookup in a file that must work in older Excel. Use HLOOKUP only when labels run across the top and the data goes down.

Which Excel versions have VLOOKUP

VLOOKUP has been in Excel for decades and works in every desktop version, Excel for Microsoft 365, Excel for the web and Excel for Mac. A workbook that uses it opens correctly almost anywhere, which is the strongest argument for it. The one limit worth knowing from Microsoft's documentation is that the lookup value cannot be longer than 255 characters; a longer one returns #VALUE!.

VLOOKUP errors and how to fix them

Every row below can be reproduced on the staff sheet.

ErrorCauseFix
#N/AThe value is not in the first column, has a hidden space, or is a text number against a real number.Check spelling and spaces with TRIM. Check both sides are numbers. Confirm the range starts at the lookup column.
#REF!col_index_num is larger than the number of columns in the range, as in =VLOOKUP(G2,A2:E7,6,FALSE).Count the columns of the range and use a number within it.
#VALUE!col_index_num is below 1, as in =VLOOKUP(G2,A2:E7,0,FALSE), or the lookup value is over 255 characters.Use 1 or higher.
#NAME?Text typed without quotes, or the function name misspelled.Put text in quotes or point to a cell.
A wrong value, no errorThe fourth argument was left off and the lookup became approximate.Type FALSE.
The text-number case is worth seeing. If G2 held the text "4104", perhaps pasted from a CSV file, =VLOOKUP(G2,A2:E7,2,FALSE) would return #N/A even though 4104 is plainly in the list. A text "4104" and the number 4104 are different values. Typing =VLOOKUP("4104",A2:E7,2,FALSE) shows the same failure, which explains many of the practice-screen mistakes below. The fix is to convert it with a double minus: =VLOOKUP(--G2,A2:E7,2,FALSE).

Trailing spaces cause the same symptom with names. =VLOOKUP("Lerato Dlamini ",B2:E7,4,FALSE), with a space at the end, returns #N/A. Wrap the lookup value in TRIM, as in =VLOOKUP(TRIM(H2),B2:E7,4,FALSE), when the input comes from people typing or from a pasted export.

What learners get wrong

Between 26 September and 3 November 2026, learners made 16,784 first attempts across our VLOOKUP Function lesson, and 61.6% were right. VLOOKUP Function 2 logged 2,659 first attempts with 74.7% right, VLOOKUP Approximate Match logged 2,039 with 73.4% right, and VLOOKUP with Multiple Criteria logged 1,093 with 78.9% right. A first attempt is the first check of a screen in a page view, not a head count of people. Four patterns explain most of the wrong answers.

1. A number typed as text. The hardest screen in the main lesson asked for the tenant in unit 254. Only 39.3% of 1,576 first attempts were right. The two most common wrong answers were =vlookup("254",a1:b4,2,0), 275 times, and =vlookup("254",a:b,2,0), 254 times. Both put quotes around a number. The correct formula is =vlookup(254,a:b,2,0), because the unit numbers are numbers. On our staff sheet, =VLOOKUP("4104",A2:E7,2,FALSE) fails for the same reason. Quote text, not numbers.

2. A column number counted from the wrong place. On the screen asking for Patrick's major in the range B:C, only 43.2% of 1,485 first attempts were right, and =vlookup("Patrick",b:c,3,0) appeared 144 times. The range B:C holds two columns, so the major is column 2, and 3 points past the end. Excel returns #REF!. The same happened with =vlookup(95,a:b,3,0), 93 times, where the instruction was to use A:B. Count columns inside the range you typed, starting at 1.

3. A range that starts in the wrong column. One screen gave a salinity of 1.2 and asked for the area of that lake. Only 45.3% of 274 first attempts were right. Answers such as =vlookup(1.2,a:c,3,false) and =vlookup(1.2,a:c,1,0) search column A for 1.2, which is not there. The salinity sits in column C, so the range must begin at C: =vlookup(1.2,c:d,2,false). The first column of the range must be the column that holds the value you know.

4. The fourth argument forgotten, or the text altered. On the approximate-match lesson, =vlookup(e2,a:c,3) and =vlookup(1,a:c,3) picked column 3 where column 2 was needed. Leaving off the fourth argument was harmless there, because approximate match was what the screen asked for. On the exact-match lake screens, =vlookup("Malawi",a:d,4) skipped it as well, which silently switches to approximate matching. Another group typed the full name, as in =vlookup("Lake Superior",a:c,3,0), when the list held only "Superior". The lookup text has to match the cell as it is written.

A worked job: pay review lookup

Your manager sends a list of staff IDs and wants name, department and salary for each, plus a flag for anyone missing. Use the staff sheet from the top of this page.

  1. Set up the lookup. Put the ID to check in G2. In I2 write =IFNA(VLOOKUP(G2,A2:E7,2,FALSE),"Not on file") for the name. For 4104 you get Sipho Nkosi.
  2. Pull the other fields from the same ID. In J2 use =VLOOKUP(G2,A2:E7,3,FALSE) for the department, which returns Sales, and in K2 use =VLOOKUP(G2,A2:E7,5,FALSE) for the salary, which returns 39000. Lock the range as $A$2:$E$7 before you fill down to the other staff IDs.
  3. Catch bad IDs before they reach payroll. Test one ID that does not exist, such as 4199. The IFNA version shows "Not on file". If that same ID were run through =VLOOKUP(4199,A2:E7,2) with no fourth argument, it would return Johan Botha instead. Running one bad ID through every new lookup takes ten seconds and tells you whether you are on exact match.
  4. Check the column numbers after any change. If a column is inserted before Monthly salary, the 5 in K2 now points at the wrong field. Swap it for MATCH("Monthly salary",A1:E1,0) or move to XLOOKUP.

Practice VLOOKUP

You learn this function by typing it. The page already carries an exercise from Practice Lesson 11, so type the formula there rather than read on.

Then continue with Practice Lesson 71 for lookups where the range has to start at a different column, Practice Lesson 80 for approximate match and bands, and Practice Lesson 95 for matching on two criteria with a helper column. If a formula comes back with the wrong answer, compare it with the four patterns above before you retry.

FAQ

How do you write a VLOOKUP formula in Excel?

Type =VLOOKUP(, then the value to find, the range, the column number to return and FALSE. For example, =VLOOKUP(G2,A2:E7,2,FALSE) searches the first column of A2:E7 for the value in G2 and returns the second column of that row. The search value must be in the first column of your range.

What does the 4th argument in VLOOKUP mean?

The fourth argument, range_lookup, sets the match type. FALSE or 0 means exact match: return #N/A if the value is absent. TRUE, 1 or leaving it blank means approximate match: find the largest value not above yours, which needs a sorted first column. For IDs and names, always use FALSE.

Why is my VLOOKUP returning #N/A when the value exists?

The usual causes are a number stored as text on one side, a trailing space, or a range that does not start at the lookup column. Test with ISNUMBER on both cells, wrap the lookup value in TRIM, and check that the first column of the range is the one holding your value.

Can VLOOKUP look to the left?

No. VLOOKUP always searches the first column of the range and can only return that column or those to its right. To return something on the left, use INDEX and MATCH, or XLOOKUP in a version that has it. Rearranging the columns so the key comes first also works.

How do you use VLOOKUP with two criteria?

Build a helper column that joins the two fields, such as =B2&"-"&C2, put it first in the range, then look up the joined text with =VLOOKUP(F2&"-"&G2,A2:D7,4,FALSE). For a numeric answer such as units or sales, SUMIFS accepts several criteria directly, so no helper column is needed at all.

How do you use VLOOKUP from another sheet?

Write the formula as usual and choose the range by clicking on the other sheet, so Excel inserts the sheet name: =VLOOKUP(A2,Rates!$A:$D,3,FALSE). Quote names with spaces. The ID must be in the first column of the range, and both sheets must store the key the same way.

Should I use VLOOKUP or XLOOKUP?

Use XLOOKUP when everyone who opens the file has Microsoft 365, Excel 2021 or later. It matches exactly by default, looks left and right, and does not need a column number. Use VLOOKUP when the file has to work in Excel 2019 or earlier, or when you maintain a sheet that already uses it.

Sources

Keep going

Guides people read next.