[英]How to return a range of cells based on a value in the adjacent column in Google Sheets
I'd like to write a formula to such that it returns a range of cells from column H (unique ID) based on a criterion that is the value in column G (parent manual id).我想编写一个公式,使其根据 G 列(父手册 ID)中的值的标准从 H 列(唯一 ID)返回一系列单元格。 So for eg the formula should return a range of all the cells highlighted in yellow (from the image below) when the criteria in the adjacent column (column G) is 1. Similarly, the formula should return a range of all the cells highlighted in blue when the criterion (column G) is 2, and so on.
因此,例如,当相邻列(G 列)中的标准为 1 时,公式应返回以黄色突出显示的所有单元格的范围(如下图)。类似地,公式应返回突出显示的所有单元格的范围当标准(G 列)为 2 时为蓝色,依此类推。
The reason, I need this to be a range of cells, is because I need to pass this resultant range as an argument into another formula (a TEXTJOIN function).原因,我需要这是一个单元格范围,因为我需要将此结果范围作为参数传递给另一个公式(TEXTJOIN 函数)。
use FILTER
使用
FILTER
=FILTER(H:H; G:G=1)
and:和:
=FILTER(H:H; G:G=2)
and then do your TEXTJOIN
for csv:然后为 csv 执行
TEXTJOIN
:
=TEXTJOIN(", "; 1; FILTER(H:H; G:G=1))
or perhaps for regex:或者也许对于正则表达式:
=TEXTJOIN("|"; 1; FILTER(H:H; G:G=2))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.