【问题标题】:Cycle through an array/range, with the values of another array/range使用另一个数组/范围的值循环遍历一个数组/范围
【发布时间】:2020-01-16 21:45:34
【问题描述】:

我有一个数组....

 {eve, 20; adam, 60; helen, 80; paris, 5}

我想用 THIS 数组的值搜索 THAT 数组的值....

 {eve; eve; helen; adam; helen}

制作这个...

 {20; 20; 80; 60; 80}

在工作表中,第一个数组在 A1:B4 范围内,第二个数组在 D1:D5 范围内

我最初的尝试看起来像这样......

=ARRAYFORMULA(if(A1:A4 = D1:D5, A1:B4, ""))

这显然行不通,在过去的 5 个小时里,我一直在绞尽脑汁尝试不同的技巧,比如将 $ 符号放在不同的范围值中,诸如......

=ARRAYFORMULA(if(A1:A4 =indirect("D"&sequence(count(d1:d5))), A1:B4, ""))

我对此还很陌生,所以,为了所有神圣的爱,请把我从这个活生生的噩梦中解救出来,我将永远感激不尽

【问题讨论】:

  • 我不了解您的来源、数组或单元格范围?

标签: google-sheets google-sheets-formula array-formulas


【解决方案1】:

数组公式:

=arrayformula(VLOOKUP({"eve"; "eve"; "helen"; "adam"; "helen"},{"eve", 20; "adam", 60; "helen", 80; "paris", 5},2,false))

单元格范围公式:

=arrayformula(VLOOKUP(D1:D5, A1:B4, 2, false))

【讨论】:

  • 感谢您甚至没有考虑尝试 vlookup!
  • 只是一个后续问题,如果我想根据附加的号码是否满足条件来提取名称,这仍然可行吗? IE。 =arrayformula(VLOOKUP({>20; 8; =60; =5},{20, "eve"; 60, "adam"; 80, "helen"; 5, "paris"},2,假))
  • 用 {1,2} 改变 2
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2019-11-14
  • 1970-01-01
  • 2018-04-07
  • 1970-01-01
  • 1970-01-01
  • 2015-07-10
  • 2018-04-09
相关资源
最近更新 更多