在 Google 个工作表中使用数组公式搜索特定文本的多行内容
Search Contents of Multiple Rows For Specific Text Using Array Formula in Google Sheets
我有一列,每行包含多个单词,示例如下:
Fight; (People: Jack, Gil, Row, Pitt); (Link: Box, Wave, Line, Guard, Circle, Wide, Arrow,)
Fight; (People: Jack, Clive, Gareth); (Link: Box, Wave, Arrow)
Fight; (People: Jack, Gil, Jan); (Link: Box, Wave, Line, Guard, Circle, Wide, Arrow, Square, Attack)
我正在尝试从这些行中提取特定的词,以便我可以统计其他信息,例如这些词出现的次数或与这些词相关联的时间。问题是我还没有找到专门搜索那个词并且只搜索那个词的方法。
Column A - Type
Column B - Time
Fight; (People: Jack, Gil, Row, Pitt); (Link: Box, Wave, Line, Guard, Circle, Wide, Arrow)
0:02:43
Fight; (People: Jack, Clive, Gareth); (Link: Box, Wave, Arrow)
0:01:54
Fight; (People: Jack, Gil, Jan); (Link: Box, Wave, Line, Guard, Circle, Wide, Arrow, Square, Attack)
0:00:23
使用以下公式搜索上述信息时,我得到这些结果:
**Participation #**
=ARRAY_CONSTRAIN(ARRAYFORMULA(FILTER(COUNTIF($A2:$A4, "*" &$D8:$D14 & "*"),NOT(ISBLANK($D8:$D14)))),COUNTA($D8:$D14),1)
**Time**
=ARRAY_CONSTRAIN(ARRAYFORMULA(IFERROR(SUMIF($A2:$A4,"*" & $D8:$D14 & "*",$B2:$B4),"")),COUNTA($D8:$D14),1)
People
Participation #
Time
Jack
3
0:05:00
Gil
2
0:03:06
Row
3
0:05:00
Pitt
1
0:02:43
Clive
1
0:01:54
Gareth
1
0:01:54
Jan
1
0:00:23
尽管只参加了一次,但由于“箭头”一词,行被计数了 3 次。是否可以进行修改,以便我只搜索特定的词? Google Sheet 供参考,感谢您的宝贵时间!
在 E8 中尝试:
=ARRAYFORMULA(IFNA(VLOOKUP(D8:D14, QUERY(SPLIT(FLATTEN(SPLIT(A2:A4, ":;, ()", 1)&"×"&B2:B4), "×"),
"select Col1,count(Col1),sum(Col2) where Col2 is not null group by Col1"), {2, 3}, 0)))
我有一列,每行包含多个单词,示例如下:
Fight; (People: Jack, Gil, Row, Pitt); (Link: Box, Wave, Line, Guard, Circle, Wide, Arrow,)
Fight; (People: Jack, Clive, Gareth); (Link: Box, Wave, Arrow)
Fight; (People: Jack, Gil, Jan); (Link: Box, Wave, Line, Guard, Circle, Wide, Arrow, Square, Attack)
我正在尝试从这些行中提取特定的词,以便我可以统计其他信息,例如这些词出现的次数或与这些词相关联的时间。问题是我还没有找到专门搜索那个词并且只搜索那个词的方法。
Column A - Type | Column B - Time |
---|---|
Fight; (People: Jack, Gil, Row, Pitt); (Link: Box, Wave, Line, Guard, Circle, Wide, Arrow) | 0:02:43 |
Fight; (People: Jack, Clive, Gareth); (Link: Box, Wave, Arrow) | 0:01:54 |
Fight; (People: Jack, Gil, Jan); (Link: Box, Wave, Line, Guard, Circle, Wide, Arrow, Square, Attack) | 0:00:23 |
使用以下公式搜索上述信息时,我得到这些结果:
**Participation #**
=ARRAY_CONSTRAIN(ARRAYFORMULA(FILTER(COUNTIF($A2:$A4, "*" &$D8:$D14 & "*"),NOT(ISBLANK($D8:$D14)))),COUNTA($D8:$D14),1)
**Time**
=ARRAY_CONSTRAIN(ARRAYFORMULA(IFERROR(SUMIF($A2:$A4,"*" & $D8:$D14 & "*",$B2:$B4),"")),COUNTA($D8:$D14),1)
People | Participation # | Time |
---|---|---|
Jack | 3 | 0:05:00 |
Gil | 2 | 0:03:06 |
Row | 3 | 0:05:00 |
Pitt | 1 | 0:02:43 |
Clive | 1 | 0:01:54 |
Gareth | 1 | 0:01:54 |
Jan | 1 | 0:00:23 |
尽管只参加了一次,但由于“箭头”一词,行被计数了 3 次。是否可以进行修改,以便我只搜索特定的词? Google Sheet 供参考,感谢您的宝贵时间!
在 E8 中尝试:
=ARRAYFORMULA(IFNA(VLOOKUP(D8:D14, QUERY(SPLIT(FLATTEN(SPLIT(A2:A4, ":;, ()", 1)&"×"&B2:B4), "×"),
"select Col1,count(Col1),sum(Col2) where Col2 is not null group by Col1"), {2, 3}, 0)))