Use VLOOKUP to join two Excel tables together
In Excel, you can merge rows from this table into another table by copying and pasting them into the first blank below the table. And if the rows match, you can merge columns from one table to another by pasting them into the first blank on the right of the table.
Connecting rows is quite simple, but linking columns of this table to another table is more complicated because the rows in this table do not always correspond to the other table. By using VLOOKUP to join the table you will avoid these annoying sorting problems.
In the example below, we have 2 tables, Blue and Orange. In the Blue table, each row is a detailed item in the order. Order ID 20050 has 2 items, Order ID 20051 has 1 item, Order ID 20052 has 3 items, so on until the end of the table. Now we need to merge the Sales ID and Region ID columns into the Blue table, based on the appropriate values in the Order ID column of the Orange table.
But the Order ID value is repeated in the Blue table, while the Orange Order ID is unique. So if you are innocent but Ctrl + C then Ctrl + V to paste, you will notice the mess in the spreadsheet. If the data is too much, you will be crazy about having to rearrange them. Try VLOOKUP and see the difference.
Here are two spreadsheets, you can copy into Excel file to follow if desired. Copy these two tables into the same Excel page, press Ctrl + T to turn it into a spreadsheet, name the worksheet in Table name, Blue and Orange respectively.
Blue board:
Order ID
Sale Date
Product ID
20050
2/2/14
C6077B
20050
2/2/14
C9250LB
20051
2/2/14
M115A
20052
2/3/14
A760G
20052
2/3/14
E3331
20052
2/3/14
SP1447
20053
2/3/14
L88M
20054
April 2, 14
S1018MM
20055
2/5/14
C6077B
20056
June 2, 14
E3331
20056
June 2, 14
D534X
Orange Table:
Order ID
Sales ID
Region
20050
447
West
20051
398
South
20052
1006
North
20053
447
West
20054
885
East
20055
398
South
20056
644
East
20057
1270
East
20058
885
East
Then, copy the Sales ID and Region header next to the Product ID header in the Blue table. Now your spreadsheet will look like this:
In cell D2, enter the following formula:
=VLOOKUP([@[Order ID]],Orange[#All],2,0)
- The [@ [Order ID]] section means "get the value in this row from the Order ID column".
- The "Orange [#All]" parameter can be entered manually if you have named the table, otherwise, simply highlight the entire Orange table with your mouse to get the function automatically and then add $ in front, or enter $ A $ 13: $ C $ 22 to select the Orange table.
- 2 is the serial number of the Sales ID column in the Orange table.
- 0 is relative detection (because here the Order ID of both tables are sorted, otherwise you must use absolute detection, replacing 0 with 1).
Then the result returned in cell D2 will be 447.
Click on the lower right corner of cell D2 until the plus sign appears, drag the mouse down to the end of the Blue table, you will get the following result:
To enter the Region column into the Blue table, simply copy the formula in cell D2 into cell E2, edit the third parameter from 2 to 3, to indicate that you want to get the third column (Region) of the Orange table.
Then point to the lower right corner of cell E2 until the plus sign appears, drag the mouse down to the end of the Blue table, you will get the following result:
As you have seen with using VLOOKUP to pair two Excel tables the data will be correctly populated, the operation is not too complicated, just a few clicks are done. This is an Excel sample file, if you still find it confusing, download it to see it for visualization.
Hopefully the trick with this VLOOKUP function is useful to you.
See also: How to use SUM in Excel
You should read it
- VLOOKUP function to use and specific examples
- How to automate Vlookup with Excel VBA
- How to combine Vlookup function with If function in Excel
- How to fix VLOOKUP error in Excel
- Vlookup function in Excel
- Look up data in Excel tables: Replace VLOOKUP with INDEX and MATCH
- How to combine Sumif and Vlookup functions in Excel
- VLOOKUP function - Usage and detailed examples
- How to use VLOOKUP Function in Excel
- How to use Vlookup function between 2 sheets, 2 different Excel files
- How to filter duplicate data on 2 Excel sheets
- How to use the XLOOKUP function in Excel?
Maybe you are interested
Should I buy a tablet with 4G LTE/5G connectivity or just WiFi?
How to adjust line spacing in Word tables very easily
10 Useful Table Formatting Tips in Microsoft Word
What's notable about Free Fire OB34 Summon?
How to update Windows offline using Portable Update
Quickly fix Unmountable Boot Volume error on Windows 10/11