简体   繁体   English

从一个单元格中查找值,从该单元格附近的单元格中复制值,然后将其粘贴到另一张纸上

[英]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 . VLOOKUPIFERROR一起使用。

=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.

相关问题 将单元格值从一张表复制到另一张表,并将其粘贴到具有特定值的单元格附近 - Copying cell values from one sheet to another, and paste it near a cell with specific value 从另一张纸上的单元格值复制同一张纸中范围的一部分的粘贴范围 - Copy Range From One Sheet Paste Part of Range In Same Sheet Based On Cell Value On Another Sheet 根据单元格值将数据从一张表复制并粘贴到另一张表 - Copy and paste data from one sheet to another sheet(s) based on cell value 根据第一张工作表中第二个单元格的值,将数据从一个单元格复制到另一张工作表中的单元格? - Copy data from one cell to a cell in another sheet based on the value of a second cell in the first sheet? 将一个单元格从一个工作表复制并粘贴到另一个工作表,然后乘以一个值 - copy and paste a cell from one worksheet to another and multiply it by a value 使用单元格值将数据从一张纸复制到另一张纸 - Copy data from one sheet to another with the cell value 根据单元格中的值将行从一张表复制到另一张表中 - Copy rows from one sheet into another depending on value in cell 使用粘贴在某些条件下将单元格值从一张纸复制到另一张纸 - Copy Cell values from One Sheet to Another on certain criteria with the paste 将单元格值(非公式)从一张纸复制并粘贴到另一张纸 - Copy and paste cell values (not formulae) from one sheet to another 从一个工作表复制单元格并粘贴到另一个工作表中到可变单元格 - Copy cells from one sheet and paste in another to a variable cell
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM