问题
I have two sheets in an Excel workbook and want to use the VLOOKUP()
function to search a table in Sheet2 and return the result to Sheet1. How might I do this?
The data looks like this:
Sheet1
A B
1 id name
2 111 Jacob
3 102 david
4 110 John
Sheet2
A B
1 id Cell
2 111 03563334879
3 102 03563331234
4 110 03563334222
回答1:
Short guide for you on VLOOKUP
, hope it helps.
The syntax for VLOOKUP
is
VLOOKUP(Lookup_Value,Table Array,Col_index_num,Range_lookup)
OR, to start in cell C2 type
=VLOOKUP(
- Then click cell A2 (The value to lookup for this row)
- Then type a comma
- Then excel allows you to click on another sheet to select the table from sheet2, so this would be range Sheet2!A2:B4
- comma
- You want to return the second row from your lookup array so type 2
- comma
- You want an exact match so type FALSE
- close brackets and hit enter
This works for cell C2 but if you drag it down using the cell bottom right corner it will fail in subsequent rows because the table array references are relative and it will move the lookup table reference down one for every cell you move down. You want to make the lookup table array fixed (not the right term) click in each of them (A2 and B4) and press F4, or just add the "$" as below. This fixes the Row and column reference so that when you copy down it will not change these references.
=VLOOKUP(A2,Sheet2!$A$2:$B$4,2,FALSE)
Now you can drag down to copy the formula.
回答2:
You can use vlookup formula. You can get the details from following link:
https://support.office.com/en-us/article/VLOOKUP-function-0bbc8083-26fe-4963-8ab8-93a18ad188a1
来源:https://stackoverflow.com/questions/37649611/using-excel-vlookup-function-across-two-sheets