简体   繁体   English

如何获取下一个值而不仅仅是第一个值 - Vlookup Importrange - google sheet

[英]How to fetch the next value instead of only the 1st one - Vlookup Importrange - google sheets

CONTEXT语境

  • I have 2 tabs in a google spreadsheet that are connected with Vlookup and Importange我在与 Vlookup 和 Importange 连接的谷歌电子表格中有 2 个选项卡
  • Both sheets have "ID" and "Payment Ref" columns两张表都有“ID”和“Payment Ref”列
  • The goal is by Adding an "ID" value, the other column fetches from the other sheet its payment ref目标是通过添加一个“ID”值,另一列从另一张表中获取其付款参考

PROBLEM问题

  • All works fine EXCEPT when an ID has multiple payment refs it always shows the first value / the first payment ref related to that ID一切正常,除了当一个 ID 有多个付款参考时,它总是显示与该 ID 相关的第一个值/第一个付款参考

RESULT结果

  • I would like that it would fetch the next payment ref related to that ID instead of always showing the same我希望它会获取与该 ID 相关的下一个付款参考,而不是始终显示相同

Thank you in advance先感谢您

Example google sheet - simplified 示例谷歌表 - 简化

I found a workaround, not sure if it is the best one, but if I create an helper column that adds to the ID value a counter (the nr of times the value appears) by using the "count" function, the vlookup can search for all matches.我找到了一种解决方法,不确定它是否是最好的,但是如果我创建一个辅助列,通过使用“计数”function 将计数器(值出现的次数)添加到 ID 值中,vlookup 可以搜索对于所有比赛。

eg例如

=A2&"-"&COUNTIF($A$2:A2;A2)

(Also added in the example sheet) (也在示例表中添加)

Unfortunately adding "Arrayformula" doesn't create an array and I need to stretch the formula along the rows.不幸的是,添加“Arrayformula”不会创建数组,我需要沿行拉伸公式。

Not perfect but if nothing better, hope it helps others.不完美,但如果没有更好的,希望它可以帮助别人。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM