如何在公式中使用ARRAYFORMULA、IF和VLOOKUP来填充列向下?

huangapple go评论103阅读模式
英文:

How do I use ARRAYFORMULA, IF, and VLOOKUP in a formula to populate down the column?

问题

我正在尝试创建一个arrayformula,它将填充到N列中。

我需要它在发布日期和成本与另一个列表(见第二张图片)匹配时找到购买者的名称。

至今,我的公式是:

=ARRAYFORMULA(IF(AND(VLOOKUP(C3:C,'X3'!B2:B,1,0)=C3:C,VLOOKUP(A3:A,'X3'!A2:B,1,0)=A3:A),VLOOKUP(A3:A,'X3'!A2:E,4,0)))

然而这个公式不起作用。我无法弄清楚如何在arrayformulaIFVLOOKUP一起使用。

英文:

Im trying to create an arrayformula that will populate down the column in COL N.

I need it to find the purchaser name if the posted date and cost match on another list (See the second image).
如何在公式中使用ARRAYFORMULA、IF和VLOOKUP来填充列向下?

如何在公式中使用ARRAYFORMULA、IF和VLOOKUP来填充列向下?

I know that the costs in the first picture dont show up in the second, but they do further down the list.

So far, my formula is:

=ARRAYFORMULA(IF(AND(VLOOKUP(C3:C,'X3'!B2:B,1,0)=C3:C,VLOOKUP(A3:A,'X3'!A2:B,1,0)=A3:A),VLOOKUP(A3:A,'X3'!A2:E,4,0)))

however this doesn't work. I can't figure out how to use an arrayformula in conjunction with IF and VLOOKUP.

答案1

得分: 2

Sure, here is the translated code:

当你尝试在多个条件之间找到匹配项时,我建议你尝试使用FILTER函数。我不确定你想要检索哪一列,我认为是D列,如果不是,请更改为:

=FILTER('X3'!D2:D,'X3'!B2:B=C3,DATEVALUE('X3'!A2:A)=A3)

要将其用作ARRAYFORMULA,你可以使用MAP函数:

=MAP(A3:A,C3:C,LAMBDA(da,cost,IF(da="",IFNA(FILTER('X3'!D2:D,'X3'!B2:B=da,DATEVALUE('X3'!A2:A)=cost),"")))

如果有用,请告诉我!
英文:

When you're trying to find a match between multiple conditions, I suggest you try with FILTER. I'm not sure what column are you trying to retrieve, I think it's D, if not change it:

=FILTER('X3'!D2:D,'X3'!B2:B=C3,DATEVALUE('X3'!A2:A)=A3)

To use it as ARRAYFORMULA you could use MAP:

=MAP(A3:A,C3:C,LAMBDA(da,cost,IF(da="","",IFNA(FILTER('X3'!D2:D,'X3'!B2:B=da,DATEVALUE('X3'!A2:A)=cost)))))

Let me know if it's useful!

huangapple
  • 本文由 发表于 2023年2月24日 07:10:20
  • 转载请务必保留本文链接:https://go.coder-hub.com/75551231.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定