How to Merge Tables from different Sheets into One Table by VLOOKUP in Excel?

Sometimes we need to merge two tables data from different sheets into one table, for example merge data in sheet2 to sheet1 based on some criteria, how can we do? Except copy data from sheet2 to sheet1 one by one, we have another way to merge data by function VLOOKUP in Excel.

First, prepare two tables. As we all know, Excel is very useful for creating table to record data, and its format is similar with database. As in database there is always a major key in the first column to relate to other tables, so here we can create two tables in two sheets with a common column like database. Be aware that the two sheets must have a common column, then we can merge data based on this column later.

Sheet1

Merge Tables from different Sheets 1

Sheet2

Merge Tables from different Sheets 2

You can see that for one student they have two scores on different sheets, we want to merge them into one table in sheet1 like ID & Name & Score A & Score B. We find they have the same columns ID and Name, we will use ID as the key column to do demonstration. Now let’s follow below steps to start to merge data.

Step 1: In sheet1, D column->cell D2, enter ‘=vlookup’ to call VLOOKUP function.

Merge Tables from different Sheets 3

You can also click on Formulas->Insert Function to load Formula Builder to insert VLOOKUP function.

Merge Tables from different Sheets 4

Step 2: Refer to each parameter in VLOOKUP function, enter the actual values and ranges in VLOOKUP function on cell D2.

Merge Tables from different Sheets 5

As column A exists in both two sheets, so we can use this column to connect two tables. The Lookup value is cell A2 in sheet1->column A, then search it from range sheet2 ->A2:C4, then returns Score B which is listed in the third column in sheet2, so finally we entered the formula as follows:


=VLOOKUP(Sheet1!A2,Sheet2!A2:C4,3,0)

Step 3: Click on Enter in cell D2. Then we get what we expect.

Merge Tables from different Sheets 6

Step 4: Copy cell D2 to D3 and D4. Or drag it down to D4 directly with formula copied.

Merge Tables from different Sheets 7

Here we get a complete table with both Score A and Score B now.

Step 5: If we change the ID orders for students in sheet1, and use the same formula to connect data, we will get an Error this time.

Merge Tables from different Sheets 8

Here we cannot find proper mapping Score B for Amy.

Step 6: Click on cell D2 and D3 to check the formula again.

Merge Tables from different Sheets 9

Merge Tables from different Sheets 10

We find that the root cause of this error is the search range from sheet2 is moved from A2:C4 to A4:C6 (A5:C7) improperly. So we need to add $ before the range to make VLOOKUP to search the fixed range absolutely.

Step 7: Re-type formula into cell D2 ‘=VLOOKUP(A2,Sheet2!$A$2:$C$4,3,0)’.

Merge Tables from different Sheets 11

We merge two tables into one properly.

Related Functions


  • Excel VLOOKUP function
    The Excel VLOOKUP function lookup a value in the first column of the table and return the value in the same row based on index_num position.The syntax of the VLOOKUP function is as below:= VLOOKUP (lookup_value, table_array, column_index_num,[range_lookup])….

 

Related Posts

VBA Macro For VLOOKUP From Another Sheet
vba macro for vlookup from another sheet1

In the previous post, you should know that how to fix or remove the #N/A error when using VLOOKUP formula to lookup value from another sheet. And this post will show you how to use VBA code to vlookup data ...

VLOOKUP From Another Sheet Not Working
vlookup from another sheet not working3

In the previous post, you should know that how to fix or remove the #N/A error when using VLOOKUP formula to lookup value from another sheet. And this post will show you reasons why your VLOOKUP formula is not working ...

Fix #N/A Error For VLOOKUP From Another Sheet
vlookup from anther sheet not working1

This post will show you how to fix the #N/A error why it occurs when you extract values from another sheet using VLOOKUP function in Excel 2016,2013,2010 or other Excel versions. How can you correct a #N/A error in VLOOKUP ...

Get Employee Information by VLOOKUP

VLOOKUP is one of the key functions among all lookup & reference functions in Excel. Today, in this article, we will show you the way to apply VLOOKUP to retrieve employee information. I hope this article will help you in ...

VLOOKUP with Two Lookup Tables

VLOOKUP is one of the key functions among all lookup & reference functions in Excel. Today we will show you the application of VLOOKUP function when there are two lookup tables. EXAMPLE Table1 and table2 record the rates of Y2020 ...

VLOOKUP with Multiple Lookup Values

VLOOKUP is one of the key functions among all lookup & reference functions in Excel. It can scan and retrieve data from a static or dynamic table based on your lookup value. It can perform approximate match or exact match ...

VLOOKUP Data by Date

VLOOKUP is one of the key functions among all lookup & reference functions in Excel. It can scan and retrieve data from a static or dynamic table based on your lookup value. It can perform approximate match or exact match ...

VLOOKUP – Retrieve Data from Another Workbook
VLOOKUP - Retrieve Data from Another Workbook 1

VLOOKUP is one of the key functions among all lookup & reference functions in Excel. It can scan and retrieve data from a static or dynamic table based on your lookup value. It can perform approximate match or exact match ...

VLOOKUP – Retrieve Data from Another Worksheet
VLOOKUP - Retrieve Data from Another Worksheet 3

VLOOKUP is one of the key functions among all lookup & reference functions in Excel. It can scan and retrieve data from a static or dynamic table based on your lookup value. It can perform approximate match or exact match ...

Case Sensitive Lookup with SUMPRODUCT and EXACT

Today, we will show you how to use SUMPRODUCT and EXACT to perform a case sensitive exact match. In this article, we provide a simple example to calculate bonus for employees whose names are case-sensitive. If you meet similar scenarios ...

Sidebar