[英]Find value from one cell, copy value from cell near to that cell and paste it to another sheet
I have 2 sheets with different values. 我有2张纸,它们的值不同。 I need to find a value from one cell.sheet1 in sheet2 and copy value from nextcell_in_the_same_row.sheet1 to nextcell_in_the_same_row.sheet2.
我需要在sheet2的一个cell.sheet1中找到一个值,然后将值从nextcell_in_the_same_row.sheet1复制到nextcell_in_the_same_row.sheet2。 It is very difficult to explain let look at the example bellow.
让我们看下面的例子很难解释。
Eg Before 例如之前
first sheet:
A B
1 aaa 123
2 bbb 456
3 ccc 789
4 ddd 122
second sheet:
A B
1 aaa
2 ada
3 cca
4 ccc
After 后
first sheet:
A B
1 aaa 123
2 bbb 456
3 ccc 789
4 ddd 122
second sheet:
A B
1 aaa *need to find value in the first sheet and copy value from B2 because aaa in A1*
2 ada *value does not exist in the first sheet so copy nothing*
3 cca *not need to copy because no value in the first sheet*
4 ccc *need to copy the value from B3*
Thank you so much! 非常感谢!
Use a VLOOKUP
along with an IFERROR
. 将
VLOOKUP
与IFERROR
一起使用。
=IFERROR(VLOOKUP(A1, Sheet1!A:B, 2, 0), "")
This will do what you described (well described, by the way!) in your question. 这将完成您在问题中所描述的(顺便说一句!)。 Drag the formula down in
Sheet2
till the bottom. 在
Sheet2
中将公式向下拖动到底部。
VLOOKUP
takes the value of A1
in sheet 2 (no sheet reference because the value is in the same sheet as the formula) and looks it up in column A of Sheet1
. VLOOKUP
接受工作表2中的A1
值(无值工作表,因为该值与公式在同一工作表中),并在工作表Sheet1
A列中查找它。
It returns the second value (hence why 2
) of the table selected in the formula (column A is 1, column B is 2). 它返回公式中选择的表的第二个值(因此为什么
2
)(列A为1,列B为2)。
The 0 tells the VLOOKUP
to look for exact matches. 0
VLOOKUP
查找完全匹配。 You don't need approximate match here. 您无需在此处进行近似匹配。
And IFFERROR
is there in case VLOOKUP
doesn't find anything (like with ada
) and instead of giving #N/A
, returns an empty cell, ""
. 如果
VLOOKUP
找不到任何东西(如使用ada
),则存在IFFERROR
,而不是给出IFFERROR
#N/A
,而是返回一个空单元格""
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.