回答

1

你會認爲條件格式會提供這種功能,但它不允許你引用其他單元。 (與Excel不同)

這是一個腳本,可以完成這項工作。 (如果你是新來的谷歌Apps腳本,閱讀this introduction。)

/** 
* The onEdit() function, when defined, is automatically invoked whenever the 
* spreadsheet is edited. (Not every change is an "edit".) 
* 
* If all of the "fill in the blanks" columns are empty, set the 
* background color of the name column in that row. 
*/ 
function onEdit(event) { 
    var row = event.range.getRow(); 
    var sheet = event.range.getSheet(); 
    var cellA = sheet.getRange(row,1); 
    // Get the range of cells B-J that make up the "fill in the blanks" range... 
    var fillInTheBlanks = sheet.getRange(row, 2, 1, 9) 
          .getValues()[0] // ... get values in 0-th row 
          .join('');  // ... and join into one string 

    // Check that string - if it is empty, the range was blank, 
    // and we should set the background color to, say, yellow. 
    if (fillInTheBlanks.length == 0) { 
    cellA.setBackground("yellow"); 
    } 
    // On the other hand, if the string was NOT blank, there is something 
    // in the "fill in the blanks" range, so we will clear the background. 
    else { 
    cellA.setBackground("white"); 
    } 
} 

/** 
* The onOpen() function, when defined, is automatically invoked whenever the 
* spreadsheet is opened. 
* 
* Iterates through all rows in spreadsheet, faking onEdit triggers, as if 
* each name has been edited. 
*/ 
function onOpen() { 
    var sheet = SpreadsheetApp.getActiveSpreadsheet(); 
    var lastRow = sheet.getLastRow(); 
    for (var row=1; row <= lastRow; row++) { 
    onEdit({range:sheet.getRange('A'+row)}); 
    } 
}; 
0

從ColumnA清除格式,選擇ColumnA和格式,條件格式...,單元格格式如果...... 自定義公式爲和:

=and(A1<>"",counta(B1:J1)=0) 

然後選擇所選擇的填充和完成

相關問題