[英]Excel - Add cell value from another sheet
I have 2 sheets 我有两张
In the first sheet I have 在第一张纸上,我有
Names and Countries 名称和国家
and in the another sheet I have Countries and Countries_id 在另一张纸上,我有Countrys and States_id
I want to add all "Countries_id" into the first sheet into the appropriate cell 我想将所有“ Countries_id”添加到第一张工作表的相应单元格中
Example 例
Sheet_one : Names and Countries Sheet_one:名称和国家
Name Country
Tomy En
Aleks Fr
Jack En
Monica Fr
Sheet_two : Countries with id Sheet_two:具有ID的国家
Country id
En 1
Fr 2
Result : 结果 :
Name Country Country_id
Tomy En 1
Aleks Fr 2
Jack En 1
Monica Fr 2
You should be able to do this with a simple VLOOKUP. 您应该可以使用简单的VLOOKUP来执行此操作。
If we say that sheet 1 starts in cell A1, then add the following formula in C2: 如果我们说工作表1在单元格A1中开始,则在C2中添加以下公式:
=VLOOKUP(B2,Sheet2!$A$2:$B$3,2,FALSE)
This says "look up the value found in B2 in the first column of the range on sheet 2 that goes from A2 to B3. When you find an exact match ("false"), return the corresponding value from column 2. 这表示“在工作表2上从A2到B3的范围的第一列中,在B2中找到的值。当找到完全匹配(“ false”)时,请从列2中返回相应的值。
Copy this to all cells under Country_id
and you're done. 将其复制到
Country_id
下的所有单元格中,即可完成操作。
Note - you need the $
signs for the $A$2:$B$3
since that reference is ABSOLUTE - as you copy down, you want to refer to the same range (could be done by naming the range if you wanted). 注意-您需要
$A$2:$B$3
的$
符号,因为该引用是绝对的-复制时,您要引用相同的范围(可以根据需要命名范围)。 The B2
value is RELATIVE, so that when you copy down, you get C2, D2, etc. B2
值是RELATIVE,因此当您向下复制时,将得到C2,D2等。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.