简体   繁体   English

Google 表格中的二维查找

[英]Two-dimensional lookup in Google Sheets

I'm doing a 2-dimensional lookup in Google Sheets to find a name anywhere on the sheet and return the value in the fourth column of the same row that the name appears in. The name may appear in multiple locations, and I want to display results for each instance, so this will need to output as an array.我正在 Google 表格中进行二维查找,以在工作表上的任何位置查找名称,并在名称出现的同一行的第四列中返回值。名称可能出现在多个位置,我想显示每个实例的结果,因此需要将 output 作为数组。

Below is what I currently have;以下是我目前拥有的; is there a more elegant way to do this?有没有更优雅的方法来做到这一点?

I'd like to avoid using Apps Script for this if possible (another user asked a similar question and that was the suggestion).如果可能,我想避免为此使用 Apps 脚本(另一位用户提出了类似的问题,这就是建议)。

=iferror(if(E3 = "", "", index(unique(query('TransposedT&O'!$A$1:$BB$70, "select D where
E contains '" & E3 & "' or
F contains '" & E3 & "' or
G contains '" & E3 & "' or
H contains '" & E3 & "' or
I contains '" & E3 & "' or
J contains '" & E3 & "' or
K contains '" & E3 & "' or
L contains '" & E3 & "' or
M contains '" & E3 & "' or
N contains '" & E3 & "' or
O contains '" & E3 & "' or
P contains '" & E3 & "' or
Q contains '" & E3 & "' or
R contains '" & E3 & "' or
S contains '" & E3 & "' or
T contains '" & E3 & "' or
U contains '" & E3 & "' or
V contains '" & E3 & "' or
Q contains '" & E3 & "' or
R contains '" & E3 & "' or
S contains '" & E3 & "' or
T contains '" & E3 & "' or
U contains '" & E3 & "' or
V contains '" & E3 & "' or
W contains '" & E3 & "' or
X contains '" & E3 & "' or
Y contains '" & E3 & "' or
Z contains '" & E3 & "' or
AA contains '" & E3 & "' or
AB contains '" & E3 & "' or
AC contains '" & E3 & "' or
AD contains '" & E3 & "' or
AE contains '" & E3 & "' or
AF contains '" & E3 & "' or
AG contains '" & E3 & "' or
AH contains '" & E3 & "' or
AI contains '" & E3 & "' or
AJ contains '" & E3 & "' or
AK contains '" & E3 & "' or
AL contains '" & E3 & "' or
AM contains '" & E3 & "' or
AN contains '" & E3 & "' or
AO contains '" & E3 & "' or
AP contains '" & E3 & "' or
AQ contains '" & E3 & "' or
AR contains '" & E3 & "' or
AS contains '" & E3 & "' or
AT contains '" & E3 & "' or
AU contains '" & E3 & "' or
AV contains '" & E3 & "' or
AQ contains '" & E3 & "' or
AR contains '" & E3 & "' or
AS contains '" & E3 & "' or
AT contains '" & E3 & "' or
AV contains '" & E3 & "' or
AW contains '" & E3 & "' or
AX contains '" & E3 & "' or
AY contains '" & E3 & "' or
AZ contains '" & E3 & "' or
BA contains '" & E3 & "' or
BB contains '" & E3 & "'"
, 0)), 1, 1)), "")

use:利用:

=ARRAYFORMULA(IFERROR(IF(E3="",, INDEX(UNIQUE(QUERY({'TransposedT&O'!$A$1:$BB$70}, 
 "select Col4 where "&TEXTJOIN(" or ", 1, "Col"&TRANSPOSE(COLUMN(E:BB))&
 " contains '"&E3&"'"), 0)), 1, 1)), ))

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

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