[英]Excel column fill up from another excel by macro or formula
I have two different excel sheets.我有两个不同的 excel 表。 One excel sheet some values which I need to compare some column and if they matches then need to copy that values on another excel sheet.
一个 excel 工作表一些值,我需要比较某些列,如果它们匹配,则需要将这些值复制到另一个 excel 工作表上。 There is lots of rows which cannot be filled manually, so i was thinking of any formula if i can use to copy that.
有很多行无法手动填充,所以如果我可以用来复制它,我正在考虑任何公式。
example:例子:
For example I need to fill orange column (N) in Sheet2 based on the matching combination from Sheet1.例如,我需要根据 Sheet1 中的匹配组合填充 Sheet2 中的橙色列 (N)。 If Column C and Column K matches the value in both sheet, then I need to copy the value of Column N from sheet 1 to Sheet 2.
如果 C 列和 K 列与两个工作表中的值匹配,那么我需要将 N 列的值从工作表 1 复制到工作表 2。
PS: the rows in both sheets are not in same orders. PS:两张表中的行顺序不同。
Adding some excel sample for easier output.添加一些 excel 示例,以便更轻松地进行 output。
Sheet1
Item_code Item_id Item_name
AB 011 ABC
CD 012 PQR
EE 045 AAS
DF 015 AAF
SD 032 DDF
FG 078 KKJ
TY 013 NJY
Sheet2
Item_code Item_id Item_name
TY 013
SD 032
CD 012
DF 015
AB 011
FG 078
EE 045
If I'm understanding the question correctly, would an IF statement suffice here?如果我正确理解了这个问题,那么这里的 IF 语句就足够了吗?
=IF(AND($C1=Sheet1,$C1,$K1=Sheet1,$K1),Sheet1!$N1,"")
=IFERROR(INDEX(SHEET1:N,N,MATCH(1:(SHEET1:C:C=@C:C)*(SHEET1,K,K=@K:K),0)),"")
would give you the desired result. =IFERROR(INDEX(SHEET1:N,N,MATCH(1:(SHEET1:C:C=@C:C)*(SHEET1,K,K=@K:K),0)),"")
会给出你想要的结果。 But it's better to use table references (but we don't know the table names).但最好使用表引用(但我们不知道表名)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.