在 Google 个工作表中删除包含特定文本的行

Removing a row containing a specific text in Google Sheets

我有大约 3000 列的数据集,但有些列有几个包含单元格 "na" 的单元格。这些行不重要,因为它们没有我需要的数据,google 工作表中是否有命令可以突出显示包含该文本的整行或删除包含该文本的整行?

如有任何帮助,我们将不胜感激。

https://docs.google.com/spreadsheets/d/1u8OUfQOzgAulf1a8bzQ8SB5sb5Uvb1I4amF5sdGEBlc/edit?usp=sharing

我的文档^.

根据我的理解回答,如有错误请见谅。您可以使用条件格式来突出显示所有 NA 文本

这是我使用的规则

以下是可能对您有帮助的其他答案

  1. Delete a row in Google Spreadsheets if value of cell in said row is 0 or blank

  2. Deleting Cells in Google Sheets without removing a whole row

抱歉英语不好。

我不确定我的理解是否正确,但看看下面你能做什么。 这是一个 google 脚本函数,它为 "na" 在

中的整个列着色
  function myFunction() {
//get the spreadsheet where the function is running
  var ss = SpreadsheetApp.getActive()
  //Replace "the name of your sheet" by your sheet name" be careful its case sensitive.
  var sheet = ss.getSheetByName("The name of your sheet")
  //Get all your data as an array (If your sheet has no header, change 2 by 1 and (sheet.getLastRow()-1) by sheet.getLastRow())
  var values = sheet.getRange(2,1,(sheet.getLastRow()-1), sheet.getLastColumn()).getValues();

  //For each column
  for (var i = 0; i< sheet.getLastColumn(); i++){
  //using function map is helping to select one column by one column
    var mapValues = values.map(function(r){return r[i]});
    //Searching your keyword in the column, in your case it's "na"
    var position = mapValues.indexOf("Put the string that you are looking for, in your case 'na'");
    //if at least there is one "na" inside the column
    if( position >-1){
    //then this color have to get red color as a background
       var wholeColumn = sheet.getRange(2,(i+1),(sheet.getLastRow()-1));
       wholeColumn.setBackground("red");
    }
  }
}``

如果有效请告诉我

您可以使用此公式为所有 na 行着色:

=ARRAYFORMULA(REGEXMATCH(TRANSPOSE(QUERY(TRANSPOSE($A1:$Z),,999^99)), " na "))