How to use the VLOOKUP function in Excel: formulas and detailed examples.

The VLOOKUP function in Excel allows users to quickly look up data by column, especially useful when working with large tables. To use it effectively, you need to understand the syntax, how to apply it, and how to troubleshoot common errors.

 

If you're new to  Excel , working with data can feel daunting. Let's explore how to use the VLOOKUP function to improve your skills.

What is Vlookup? Calculation formula and illustrative examples.

 

Quick Overview:
I. What is the Vlookup function?
II. Syntax
III. Illustrative Examples
IV. How to combine Vlookup with Hlookup, Left, Right, and Match
V. Common Errors When Using the Function

I. What is the VLOOKUP function?

VLOOKUP is a basic and common function in Excel that allows users to search for data by column. You can quickly look up and get the desired results with just a few clicks.
 

II. Usage Syntax

In there:

- lookup_value: The value used for searching.

table_array: The lookup table, set to Absolute address format (with a $ sign in front by pressing F4).

col_index_num: The order of the column from which to retrieve data in the lookup table.

range_lookup: The search range. TRUE is equivalent to 1 (relative lookup), FALSE is equivalent to 0 (absolute lookup).
 

III. Illustrative Examples

With Vlookup's relative and absolute lookup capabilities, you can easily summarize data in Excel spreadsheets, helping you to compile details for reports, filter out necessary lists, and make your work more accurate and time-efficient.
 

1. Relative search

Example: Based on the grading scale corresponding to the given scores, determine the academic performance of the students listed below:

Example of the Vlookup function in Excel

We use the formula in column D6: =VLOOKUP(C6,$C$16:$D$20,2,1)
The result obtained is:

Results when using the VLOOKUP function
 

2. Absolute search

Using an absolute search will yield more detailed results than a relative search.
For example: Fill in the information on the hometown and qualifications of employees in the table based on the corresponding employee codes below.

Example of absolute lookup using the VLOOKUP function.

To fill in the employee's hometown information, use the VLOOKUP formula in cell E6 as follows: =VLOOKUP(A6,$D$12:$F$17,2,0)
A6 is the value to look up
$D$12:$F$17 is the lookup table
2 : column number in the lookup table
0 : Exact match type

Similarly, to fill in the employee's qualification field, do the following:

The formula for cell F6 is: =VLOOKUP(A6,$D$12:$F$17,3,0)

Results when searching for absolute value

3. Relative value and absolute value

Using absolute values ​​will give you the most accurate results. Absolute values ​​will not change their addresses even if they appear in new columns or cells. Therefore, we use absolute values ​​when we need to find the most precise information and relative values ​​when we need to find the most accurate or nearly accurate results. To learn more, you can refer to the article on referencing functions in Excel .

 

IV. How to combine Vlookup with Hlookup, Left, Right, and Match

This problem combines lookup functions with Hlookup functions , or Left, Right, and Match functions.

Given the data as shown in the table below, with the following conventions:
- Table 1: RICE CONSUMPTION STATISTICS
- Table 2: TABLE OF PRODUCT NAMES, MANUFACTURER NAMES AND UNIT PRICES

The following needs to be addressed:

Question 1: Based on the two left and two right characters of the Product Code in Table 1, look up the values ​​in Table 2 to fill in the Product Name - Manufacturer Name column (Calculate data for columns C5:C10).
Example: KD-ND means Khang Dan rice - Nam Dinh.
Question 2: Fill in the Unit Price for each item based on the Product Code in Table 1 and look it up in Table 2. (Calculate data for columns D5:D10).
Question 3: Calculate the total amount = Quantity * Unit Price

Answer:

Question 1:
- Explanation: We need to provide a formula to retrieve the Product Name and the Province of Manufacture data, then combine these two formulas to get the answer to Question 1.

 + Get Product Name: Take the leftmost 2 characters in the Product Code column in Table 1 (A5:A10) and compare them to the 2 characters in the Product Code column in Table 2, but the data range should also include the Product Name column in Table 2 (A15:B20) or (A15:E20).
 >> We use the VLOOKUP function: In a cell that doesn't have data, try entering the following formula: =VLOOKUP(LEFT(A5,2),$A$15:$B$20,2,FALSE)
After entering, press Enter. If the word "Khang Dân" appears, you've completed 40% of the answer to Question 1. Simple, right? Let's continue.

+ Get the Province Name of Production: Compare the two characters on the right in the Product Code column (A5:A10) in Table 1 with the two characters in the "Row" Rice Code - Province Name of Production in Table 2. The data range to be retrieved will be (A16:E20).
 >> To retrieve data by row, we use the Hlookup function. In a cell that doesn't have data, try entering the following formula:

= HLOOKUP(RIGHT(A5,2),$C$16:$E$20,2,FALSE)
After entering the code, press Enter again. If the result is "Nam Dinh", you have completed 40% of the answer to Question 1. At this point, you should have a good idea of ​​the answer, right? The next step is to combine these two functions to calculate the data in the Product Name - Province Name column.

+ Combining two formulas: There are many formulas to combine or concatenate strings together. In this problem, Free Download guides you on how to concatenate strings using the & function. In this problem, we will use a hyphen (with a space) to separate the two formulas that have already calculated the results, namely the Product Name and the Province of Production Name, specifically: " - "
 In summary, the function will be as follows: =+vlookup&" - "&hlookup (No equals sign at the beginning of the Hlookup function anymore).
 Then, in cell C5, enter the formula:
 C5=+VLOOKUP(LEFT(A5,2),$A$15:$B$20,2,FALSE)&" - "&HLOOKUP(RIGHT(A5,2),$C$16:$E$20,2,FALSE)
 Press Enter to see the result. If the answer is correct, it should be "Khang Dan - Nam Dinh".
 Once the result is correct, in the next cell C6:C10, just point your mouse to the formula in cell C5 and drag it down to C10, and you're done
 . Similarly,

C6=+VLOOKUP(LEFT(A6,2),$A$15:$B$20,2,FALSE)&" - "&HLOOKUP(RIGHT(A6,2),$C$16:$E$20,2,FALSE)
That completes Question 1 of the problem. Let's continue to solve Question 2.

Question 2: Calculate the
Unit Price. The formula will be as follows: In cell D5, enter the formula
D5=+VLOOKUP(LEFT(A5,2),$A$16:$E$20,MATCH(RIGHT(A5,2),$A$16:$E$16,0),FALSE)

Question 3: Calculate the total amount.
Oh, this question often appears in data calculation problems such as payroll, expenses, total amount, etc. It's quite easy, isn't it?
The formula for calculating the total amount is as follows: In cell F5, enter E5 = + D5 * E5

 

V. Common errors when using

1. Error #N/A

What is the #NA error?  The #NA error is returned in an Excel formula when a suitable value is not found. When using VLOOKUP, we encounter the #NA error when the search condition is not found in the control, specifically in the first column of the function's condition range.


 

2. Error #REF!

The #REF! error occurs when the specified column is undefined, for example, in the example below,  Col_index_num is 3 , while Table_array is B2:C10, which only has 2 columns. Therefore, the system will report the #REF! error.


 

3. Error #VALUE!

The #VALUE! error occurs when the  Col_index_num column in the formula is less than 1. For example, in the example below,  Col_index_num equals 0 , resulting in the #VALUE! error.


 

4. Error #NAME?

The #NAME? error  appears when Lookup_value is missing quotation marks ("") (quotation marks are used to format text and help Excel understand formulas). For example, the example below shows " Cabbage " but it lacks quotation marks (""), causing Excel to misunderstand the formula.  To fix this, replace " Cabbage " with "Cabbage" .

 

VI. Some notes when using the VLOOKUP function

1. Use absolute references

Using absolute references allows you to copy formulas from one column to another without them changing.

As in the example below, the formula in cell C13 is =VLOOKUP(B13,$B$2:$C$10,2,0) . When copying this formula to cell C14, Table_array will remain unchanged.


 

2. Do not save numerical values ​​as text.

If the numerical data in the data table is in text format, as in the example below for column A, when you enter the formula =VLOOKUP(A8$A$2:$B$5,2,0) in the revenue column, the data will return the #N/A error. To convert text data to numbers, simply select Home => Select Wrap Text => Select Number .


 

3. The lookup table contains duplicate values.

If your table contains multiple duplicate values, the VLOOKUP function will return the first result it finds from top to bottom. For example, in the table, it returns the result "Apple" as 97 instead of 23 below.

Solution 1: If you want to remove duplicate values, highlight the lookup table and select Data  => Select  Remove Duplicates

Solution 2: Use a Pivot Table to filter the results list.


The VLOOKUP function in Excel helps you look up and return matching values ​​from a data table, supporting quick column-based searches. This function has two modes: relative lookup for approximate values ​​and absolute lookup for exact matches. To improve lookup efficiency, you can combine VLOOKUP with MATCH for more flexibility in identifying the data column to retrieve results from. If you want to look up rows instead of columns, the HLOOKUP function is a suitable choice. Understanding how these functions work and combining them flexibly will help you process data more quickly and accurately in Excel.

Other Office information articles
  • Basic Excel functions in accounting

    there are many basic accounting functions that excel learners need to know to use in their work. the use of excel functions ranges from easy to difficult, and the basic accounting excel functions discussed in this article will be extremely useful knowledge for readers who want to learn excel and use basic excel functions in accounting.
  • Tips for using Google Docs more effectively

    google docs is a convenient online document creator and editor, preferred by many for creating reports and collaborating on projects. even if you've mastered the basic features of google docs, there are some tips for using it effectively that you may not have heard of. some google docs tricks include using keyboard shortcuts, drag-and-drop functionality, creating shortcuts, restoring previous versions of documents, and translation, etc.
  • How to limit responses in Google Forms

    besides manually restricting responses in google forms or using built-in features, users can also install third-party browser extensions to perform similar functions.
  • How to type mathematical formulas in Google Docs

    as a popular online work application for office workers, google docs supports document creation in many different formats, including charts, images, and mathematical formulas. if you don't know how to insert, import, or type mathematical formulas in google docs, the content in this article will help you solve your problem.
  • How to strike through text in Google Sheets and Google Docs

    similar to microsoft word and excel, google docs and google sheets on google drive also support strikethrough text formatting. in this article, tipsmake will guide you on how to easily and simply strikethrough text in google sheets and google docs.
  • How to set edit permissions for spreadsheets in Google Sheets

    knowing how to set editing permissions for spreadsheets in google sheets helps you use google sheets effectively, allowing you to easily grant or restrict access to everyone who can view and edit your spreadsheets.
Category

System

Windows XP

Windows Server 2012

Windows 8

Windows 7

Windows 10

Wifi tips

Virus Removal - Spyware

Speed ​​up the computer

Server

Security solution

Mail Server

LAN - WAN

Ghost - Install Win

Fix computer error

Configure Router Switch

Computer wallpaper

Computer security

Mac OS X

Mac OS System software

Mac OS Security

Mac OS Office application

Mac OS Email Management

Mac OS Data - File

Mac hardware

Hardware

USB - Flash Drive

Speaker headset

Printer

PC hardware

Network equipment

Laptop hardware

Computer components

Advice Computer

Game

PC game

Online game

Mobile Game

Pokemon GO

information

Technology story

Technology comments

Quiz technology

New technology

British talent technology

Attack the network

Artificial intelligence

Technology

Smart watches

Raspberry Pi

Linux

Camera

Basic knowledge

Banking services

SEO tips

Science

Strange story

Space Science

Scientific invention

Science Story

Science photo

Science and technology

Medicine

Health Care

Fun science

Environment

Discover science

Discover nature

Archeology

Life

Travel Experience

Tips

Raise up child

Make up

Life skills

Home Care

Entertainment

DIY Handmade

Cuisine

Christmas

Application

Web Email

Website - Blog

Web browser

Support Download - Upload

Software conversion

Social Network

Simulator software

Online payment

Office information

Music Software

Map and Positioning

Installation - Uninstall

Graphic design

Free - Discount

Email reader

Edit video

Edit photo

Compress and Decompress

Chat, Text, Call

Archive - Share

Electric

Water heater

Washing machine

Television

Machine tool

Fridge

Fans

Air conditioning

Program

Unix and Linux

SQL Server

SQL

Python

Programming C

PHP

NodeJS

MongoDB

jQuery

JavaScript

HTTP

HTML

Git

Database

Data structure and algorithm

CSS and CSS3

C ++

C #

AngularJS

Mobile

Wallpapers and Ringtones

Tricks application

Take and process photos

Storage - Sync

Security and Virus Removal

Personalized

Online Social Network

Map

Manage and edit Video

Data

Chat - Call - Text

Browser and Add-on

Basic setup