Google表格-ARRAYFORMULA中的VLOOKUP [英] Google sheets - VLOOKUP inside ARRAYFORMULA
问题描述
我正在尝试在Google表格中的数组公式中执行Vlookup.
I am trying to do Vlookup inside an Array formula in Google Sheets.
我有两张纸S1和S2.
I have two sheets, S1 and S2.
每个列都有3个相同的列,即A列(日期),B列(名称)和C列(付款类型)
Each has 3 identical columns, Col A (Date), Col B(Name) and Col C(Payment-Type)
我想根据日期和姓名组合匹配,将付款类型从工作表2读入工作表1.这意味着如果日期和名称与工作表2中的相匹配,则返回付款类型".
I would like to read the payment type from sheet 2 into sheet 1 based upon date and name combination match. Meaning if the date and name matches in sheet 2, return the Payment Type.
这是我的Vlookup公式,
Here is my Vlookup formula,
=VLOOKUP(A2,FILTER('S2'!A2:C7,'S2'!A2:A7 = A2,'S2'!B2:B7 = B2),3,FALSE)
上面的公式说明:
S1是表1,S2是表2
S1 is sheet 1 and S2 is sheet 2
A2<-表格1上的日期
A2 <- Date from sheet 1
'S2'!A2:C7<-整个工作表2范围
'S2'!A2:C7 <- Entire sheet 2 range
'S2'!A2:A7 = A2<-将工作表2中的日期与工作表中A2中的日期进行比较 1
'S2'!A2:A7 = A2 <- Comparing sheet 2 dates with Date in A2 of sheet 1
'S2'!B2:B7 = B2<-将工作表2的名称与工作表的B2中的名称进行比较 1
'S2'!B2:B7 = B2 <- Comparing sheet 2 names with Name in B2 of sheet 1
3<-如果 日期和名称匹配.
3 <- Returning the third column value which is Payment Type if the date and name match.
这很好.这是带有示例的电子表格链接:
This works well. Here is a link to the spreadsheet with an example:
我想用第二行中的一个Array公式替换所有行中的Vlookup公式.
I would like to replace the Vlookup formulas on all rows with just one Array formula in the second row.
这是我现在无法使用的东西.
This is what I have now which is not working.
=ARRAYFORMULA(VLOOKUP($A$2:$A$7,FILTER('S2'!A$2:C$7,'S2'!$A$2:A7 = $A$2:$A$7,'S2'!$B$2:B7 = $B$2:B7),3,FALSE))
请,有人可以告诉我这是怎么回事吗?这些公式我可怜.请参考我上面所附的表格.那会为您解释一切.
Please, can someone tell me what is wrong here? I am pretty poor with these formulas. Kindly refer the sheet I attached above. That will explain everything to you.
推荐答案
删除C列的所有内容,然后在C1中输入
Remove all contents of column C and then enter in C1
={"Payment Type"; ARRAYFORMULA(IF(LEN(A2:A), VLOOKUP($A2:A&B2:B,{'S2'!$A$2:A7&'S2'!$B$2:B7, 'S2'!$C$2:C7},2,FALSE),))}
看看是否可行?
这篇关于Google表格-ARRAYFORMULA中的VLOOKUP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!