简体   繁体   English

Excel-从另一个工作表添加单元格值

[英]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.

相关问题 连接另一个工作表中的Excel单元格值 - Concatenate Excel cell value from another sheet Excel:另一个工作表中单元格值的名称工作表选项卡 - Excel: Name sheet tab from cell value in another sheet excel根据另一个单元格值从另一个工作表中提取数据 - excel pulling data from another sheet based on another cell value 如何有条件地用另一个工作表中另一个单元格值的另一个单元格信息替换excel中的单元格信息 - How to replace cell info in excel conditionaly with another cell info from another sheet regarding to another cell value 如何将Excel中的单元格值限制为另一个工作表中的选项? - How to limit cell value in Excel to options from another sheet? Excel:如何让IF函数从另一个工作表返回单元格的值 - Excel: How to have an IF function return the value of the cell from another sheet 从一个单元格中获取价值并将其集中在另一张表上 Vba Excel - Get Value from one cell and focus it on another sheet Vba Excel 根据单元格值将行从一个 Excel 工作表复制到另一个 - Copying rows from one Excel sheet to another based on cell value 如果来自另一个Excel工作表的A1,则在Excel工作表的单元格B1中自动插入文本值 - Insert a text value automatically in cell B1 of an excel sheet if A1from another excel sheet 使用VBA将单元格值复制到Excel中的另一个工作表 - Copying Cell Value to another sheet in Excel with VBA
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM