google-sheets - 谷歌表格中的查找值

标签 google-sheets vlookup lookup transpose flatten

我需要一些有关 Google 表格查找的帮助。我尝试使用 VLOOKUP 来执行此操作,但没有成功。我是 Google 表格初学者,因此需要一些入门帮助。

我有 2 张 Google 表格。

这是工作表1

Name
Emma
Kate
Tori
Rick
Jack
Topp
Brit

这是工作表2

Level1 Level2 Level3 State   City
Brit   Tori   Kate   Florida Orlando
Brit   Tori   Rick   Alabama Gunther
Brit   Topp   Rick   Texas   Dallas
Jack   Emma   Rick   Ohio    Dayton
Jack   Emma   Rick   Utah    Puntin
Jack   Emma   Rick   Maine   Lunop

我想向sheet1 添加 2 列,使其看起来像这样。

Name State                     City
Emma Ohio, Utah, Maine         Dayton, Puntin, Lunop
Kate Florida                   Orlando
Tori Florida, Alabama, Texas   Orlando, Gunther, Dallas
…and so on for the rest.
Rick
Jack
Topp
Brit

最佳答案

用途:

=ARRAYFORMULA(IFNA(REGEXREPLACE({
 VLOOKUP(A2:A, TRIM(SPLIT(FLATTEN(QUERY(QUERY(SPLIT(FLATTEN(
 SEQUENCE(COUNTA(E2:E), COUNTA(E2:G))&"×"&E2:G&"♥×"&H2:H&","), "×"), 
 "select max(Col3) where Col2 is not null 
  group by Col1 pivot Col2"),,9^9)), "♥")), 2, 0), 
 VLOOKUP(A2:A, TRIM(SPLIT(FLATTEN(QUERY(QUERY(SPLIT(FLATTEN(
 SEQUENCE(COUNTA(E2:E), COUNTA(E2:G))&"×"&E2:G&"♥×"&I2:I&","), "×"), 
 "select max(Col3) where Col2 is not null 
  group by Col1 pivot Col2"),,9^9)), "♥")), 2, 0)}, ",$", )))

enter image description here

关于google-sheets - 谷歌表格中的查找值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/73483484/

相关文章:

google-sheets - 谷歌工作表 : create incremental number for multiple merged cells

Excel:需要有关不寻常查找功能的帮助(排序列与查找列不同)

excel - 工作簿中跨工作表的 VLOOKUP ID#

arrays - Google Sheets - 查询具有不同结构的多个工作表

c# - DevExpress Lookup编辑问题

javascript - Lookup 字段的 DataValue 始终为空

google-apps-script - (如何)我可以在 Google Apps 脚本中使用模块模式?

google-apps-script - Google 电子表格脚本 : Disable Other Users Form Adding, 删除或移动列

google-apps-script - 每次运行脚本时如何增加脚本中引用的单元格?

excel - 我可以在 vlookup 中使用动态表数组吗?