Google sheets 如何在GoogleSheet中的特定列的输入上添加和突出显示行

Google sheets 如何在GoogleSheet中的特定列的输入上添加和突出显示行,google-sheets,google-sheets-formula,array-formulas,google-sheets-query,gs-vlookup,Google Sheets,Google Sheets Formula,Array Formulas,Google Sheets Query,Gs Vlookup,在附加的谷歌表 谷歌表单- 我需要对输入执行以下两个操作 添加与ID相同数量的行,如果任何用户在列K中将值设置为1 例如,如果我在K列中为有5行的ID=ID\u 3输入1,我想在下面的5行中添加ID\u 3的最后一个实例,并在附加行中,所有值都应该与ID\u 3相同,除了C列现在是ID\u 3\u append,列K和O,对于附加行,该列应为空 如果有人在M列中输入值为1,我们需要检查它属于哪个ID,并在E、F和G列中查找该ID,如果在E、F和G列中用户提供输入值为1的ID可用,则用红色突出显示

在附加的谷歌表

谷歌表单-

我需要对输入执行以下两个操作

  • 添加与
    ID
    相同数量的行,如果任何用户在列K中将值设置为1
  • 例如,如果我在K列中为有5行的
    ID
    =
    ID\u 3
    输入1,我想在下面的5行中添加
    ID\u 3
    的最后一个实例,并在附加行中,所有值都应该与
    ID\u 3
    相同,除了C列现在是
    ID\u 3\u append
    ,列K和O,对于附加行,该列应为空

  • 如果有人在M列中输入值为1,我们需要检查它属于哪个
    ID
    ,并在E、F和G列中查找该ID,如果在E、F和G列中用户提供输入值为1的
    ID
    可用,则用红色突出显示行

  • 如果有人在更改类型中将值添加为1,我需要将
    Test_1
    表中的
    Put_列表
    中的列B更新为I,但希望在早期的
    Test_1
    Put_列表`之间保持公共ID的
    标记状态
    。此外,我们需要相应地突出显示依赖行


  • 一旦我们将B列更新为I,我们需要将名称从“Call”更改为“Put”。

    这可能会回答您问题的第二部分。 选择要在其上设置红色条件格式的行的范围,例如样本工作表中的A2:A12。 选择“格式-条件格式”,验证范围并应用自定义公式,如下所示:

    =OR(
      IF($E2<>"NA",IFERROR(MATCH($E2,FILTER($C$1:$C$12,$M$1:$M$12=1),0)),0),
      IF($F2<>"NA",IFERROR(MATCH($F2,FILTER($C$1:$C$12,$M$1:$M$12=1),0)),0),
      IF($G2<>"NA",IFERROR(MATCH($G2,FILTER($C$1:$C$12,$M$1:$M$12=1),0)),0))
    
    =或(
    如果($E2“NA”,IFERRO(匹配($E2,过滤器($C$1:$C$12,$M$1:$M$12=1),0)),0),
    如果($F2“NA”,IFERRO(匹配($F2,过滤器($C$1:$C$12,$M$1:$M$12=1),0)),0),
    IF($G2“NA”,IFERROR(匹配($G2,过滤器($C$1:$C$12,$M$1:$M$12=1),0)),0))
    
    过滤器
    提取更新列ColM中有“1”的ID

    MATCH
    查看依赖项列中的ID是否在该筛选列表中

    如果不匹配,
    IFERROR
    将结果设置为零

    而初始的
    IF
    ,则过滤掉依赖项列中的NA值

    此逻辑为每个依赖项列复制,因此有三个IFs

    整个过程都被包装在OR函数中,因此,如果任何依赖项列具有匹配的ID,则整行将标记为红色

    我已经在你的工作表中添加了一个标签,Test_1-GK

    让我知道这是否有帮助

    恐怕我不明白你问题的第一部分。我被这一点弄糊涂了:

    我想在下面的五行中追加ID_3的最后一个实例,在追加的行中,所有值都应该与ID_3相同,除了C列现在是ID_3_追加,K列和O列对于追加的行应该为空。

    使用:

    =ARRAYFORMULA(QUERY({QUERY({Test_1!A:O; 
     IFERROR(IF(IFNA(VLOOKUP(Test_1!C2:C, SORT({Test_1!C2:C, Test_1!K2:K}, 2, 0), 2, 0))=1, 
     {Test_1!A2:A, Test_1!B2:B, Test_1!C2:C&"_Append", Test_1!D2:J, Test_1!X2:X*0, 
      Test_1!L2:L, Test_1!X2:Y*0, Test_1!O2:O}, 
     {"","","","","","","","","","","","","","",""}), 
     {"","","","","","","","","","","","","","",""})}, 
     "where Col1 is not null and not Col3 matches '"&
     TEXTJOIN("|", 1, "×", UNIQUE(IF(IFNA(VLOOKUP(Test_1!C2:C, 
     SORT({Test_1!C2:C, Test_1!N2:N}, 2, 0), 2, 0))=1, Test_1!C2:C, )))&"' order by Col3", 1);
      
     IF(LEN(TEXTJOIN("|", 1, 
     UNIQUE(IF(IFNA(VLOOKUP(Test_1!C2:C, SORT({Test_1!C2:C, Test_1!N2:N}, 2, 0), 2, 0))=1, Test_1!C2:C, ))))>0, 
     QUERY({IF(Put_list!A2:A="",,IFERROR(Put_list!A2:A*1, "Put")), Put_list!A2:H, 
     IFNA(VLOOKUP(Put_list!B2:B&"♦"&COUNTIFS(Put_list!B2:B, Put_list!B2:B, ROW(Put_list!B2:B), "<="&ROW(Put_list!B2:B)), 
     {Test_1!C2:C&"♦"&COUNTIFS(Test_1!C2:C, Test_1!C2:C, ROW(Test_1!C2:C), "<="&ROW(Test_1!C2:C)), Test_1!J2:O}, {2,3,4,5,6,7}, 0))}, 
     "where Col3 matches '"&TEXTJOIN("|", 1, 
     UNIQUE(IF(IFNA(VLOOKUP(Test_1!C2:C, SORT({Test_1!C2:C, Test_1!N2:N}, 2, 0), 2, 0))=1, Test_1!C2:C, )), 
     UNIQUE(IF(IFNA(VLOOKUP(Test_1!C2:C, SORT({Test_1!C2:C, Test_1!N2:N}, 2, 0), 2, 0))=1, Test_1!C2:C&".+", )))&"'"), 
     {"","","","","","","","","","","","","","",""})}, "where Col1 is not null order by Col3", 1))
    

    谢谢,第二部分很好用。在第一部分中,我只想知道,如果有人在addduplicate中输入1,我想将与该特定
    ID
    相关联的所有行按照与输入1的ID完全相同的顺序追加。另外,我想将附加行的
    ID
    Actual\u ID
    重命名为
    Actual\u ID\u Append
    ,在我的示例中,我想不出任何不使用脚本的方式来实现行插入,而其他人更适合提供脚本。但为了澄清,对于具有相同ID的相邻行,K列中的单元格是否总是要合并?但是,它可能对解决方案没有影响。@ KKKG13:我们可以将它保持为未合并的,但是如果任何人在列k中对同一ID输入值为1,则我们应该自动为该特定的ID在该列k中的所有空白单元格复制该值。@ KIKG13-这个问题是GooGeSeGET可以实现的吗?我需要您的意见。是的,我肯定是的。我知道这可以用脚本完成,类似于Excel中的VBA代码。可能不需要脚本就可以完成,但可能会很混乱,需要多张工作表。我相信这里有人会帮你的,如果你给它几天时间的话。特别是你提供的赏金…在我的答案中添加了一些注释…为什么不复制粘贴解释文本在这里?只是哇。。。但这正是我所期待的,一位专家。。。
    transcript:
    
    we start with array of {C, K} columns that we sort based on K column so if K column contains 1 then it will be moved up                                                 
    this is convinient for VLOOKUP coz it will always look for 1st unique value eg. exactly wat we need if our array is sorted                                                  
    so we vlookup C values to match our sorted array and return column K for all same IDs                   2 stands for 2nd column from sorted array and 0 stands for "exact match"                                
    if no match is found vlookup will output #N/A error so we wrap it into IFNA - then if no match is found vlookup will output empty rows                                                  
    then we put this into IF statement... if our vlookup outputs 1, we output our columns (again in {array} form                                                    
    if our vlookup outputs 0 then we output array of 15 empty cells in a row {"","","", .....}                  this is because we use arrays {} and all ranges in arrays needs to be of same size                              
                        our table has 15 columns so if some error would happen the we would get error in one single cell aganist our 15 columns                                 
                        this way we avoid "array_literal error" having {15 columns; 15 cells in a row which is also 15 columns}                             
                        ; semicolon puts these two arrays/ranges under each other while , comma will put then next to each other                                
    so if vlookup results in 1 then we assemble our array with ranges... A, B columns are same then we append to C column the phrase "_Append" with &                                                   
    D:J columns are same... then we force column of zeros by multipling random empty column (X) with 0                      etc.                            
    then again we use {"","","", ....} within IFERROR to deal with any possible error at this point                                                 
    next we put all written above under our whole range Test_1!A:O and we wrap it into QUERY where we state to filter out all empty rows where Col1 is empty and 2nd condition of our query states                                                  
    that Col3 of our array cant match our regex pattern which we assemble with TEXTJOIN formula                                                 
        | stands for "or" in regex. 1 in textjoin means "all non empty cells". then we use × (unique symbol) in case textjoin would output empty cell on its own resulting in some error somewhere                                              
        again we perform same vlookup, same ifna and same IF but now we output only C column and we are interested only into UNIQUE values                                              
    then within the query we sort / order by Col3 our table and 1 at the end stands for "header rows"